Design a RASP (Runtime Application Self-Protection)

Medium45 min
1 / 30
System design answer

Design a RASP (Runtime Application Self-Protection)

Medium45 min30 sections
understanding•10 min read

Problem Statement: Security From Inside the Runtime

Frames RASP as an in-process protection plane that sees data the perimeter never can, and separates detection latency from application latency.

Problem statement

Design a Runtime Application Self-Protection (RASP) platform that ships a lightweight agent inside each application process, observes security-relevant function calls and data flows as they happen, evaluates them against policy, and either blocks, sanitizes, or alerts on malicious behavior in real time. The platform must also collect interception telemetry, tune rules centrally, and roll out detection logic safely across a large fleet of application instances.

A Web Application Firewall sits outside the process and inspects raw HTTP before it is parsed. It cannot see that a value the user submitted was deserialized, stored, later read back, and concatenated into a query. A Static Analysis Security Testing (SAST) tool reads source but never knows which paths actually execute in production. RASP closes both gaps because it runs where the data and the dangerous sinks meet: inside the application's own memory and call graph.

Why the problem is distinctive

The design tension that defines RASP is not detection accuracy alone. It is the conflict between being on the critical path of every request and being allowed to add almost no latency or memory. If the agent adds 40 milliseconds to a 60-millisecond endpoint, the security team has degraded the product it was hired to protect. Therefore the architecture must separate the cheap synchronous decision (block or allow, on a microsecond budget) from the expensive asynchronous work (correlation, machine scoring, evidence upload) that happens off the request path.

This answer treats the agent as a safety-critical dependency. A crash or runaway loop in the protection agent must never take down the business application. That means the agent needs its own watchdogs, CPU and memory budgets, a kill switch, and a fail-open or fail-closed policy chosen deliberately per environment.

The four planes

  1. Instrumentation plane: bytecode or CLR hooking that taps security-relevant sinks and sources without changing program semantics.
  2. Decision plane: taint propagation plus rule and anomaly evaluation that returns block, allow, monitor, or sanitize within a strict latency budget.
  3. Control plane: policy distribution, rule versioning, rollout rings, allowlist management, and kill switch.
  4. Telemetry plane: event collection, deduplication, aggregation, analytics dashboards, and feedback into rule tuning.

A strong answer keeps these planes separate. The decision plane must degrade without weakening protection semantics, and the telemetry plane must never block a request because a broker is slow.

Public baseline versus design assumptions

Publicly available references show the category is mature. Contrast Security popularized the Java agent RASP model. Dynatrace ships a single OneAgent that performs code-module injection across languages. Baidu open-sourced OpenRASP, a PHP/JVM agent that hooks sinks rather than tracking every taint. These are cited as context. Unless a number is tied to a published source, every scale figure, latency target, and SLO below is an explicit design assumption.

Key Highlights

  • •RASP sees data flow inside the process, which a perimeter WAF and a static SAST tool both miss.
  • •The defining trade-off is on-path decision latency versus application latency; separate cheap synchronous verdicts from expensive async analytics.
  • •The agent is a safety-critical dependency and needs its own budgets, watchdog, and kill switch.
  • •Four planes: instrumentation, decision, control, and telemetry.
  • •Every uncited number in this answer is an explicit design assumption, not a vendor claim.
Lead With the Visibility Gap
State in the first two minutes that RASP detects what a WAF structurally cannot: a value that was parsed, stored, and later reused in a dangerous sink. That instantly separates a RASP answer from a generic WAF answer.
Do Not Put ML on the Hot Path
Running a heavy anomaly model synchronously per call is the classic error. The on-path verdict must be cheap; expensive scoring happens asynchronously on a copy of the event.

Section Rescue Kit

Buzzwords to use:

SinkTaint Tracking

Safe statements:

  • "I will separate the fast synchronous verdict from the slower asynchronous analysis before choosing any technology."
  • "Before picking hooking mechanisms, let me define which calls are on the critical path and which are only observed."
Design a RASP (Runtime Application Self-Protection) - System Design | WinJob | WinJob