WAF vs RASP: filtering requests outside the code, or watching it from inside
A web application firewall judges a request before the application handles it. Runtime application self-protection, RASP, sits inside the application and watches what the code does with that request. They look at the same traffic from opposite sides of the application boundary, and each is blind where the other can see.
Quick facts
- WAF
- Applies rules to an HTTP conversation before the application sees it. OWASP: “an application firewall for HTTP applications” (OWASP)
- RASP
- Runs inside the application’s own runtime and observes what the code does. The term comes from vendors; OWASP’s community pages carry no general web definition of it
- Nearest OWASP idea
- AppSensor: application layer intrusion detection and automated response, built into the application (OWASP AppSensor)
- What neither does
- Repair the vulnerable code. OWASP calls a virtual patch “a temporary work-around” that buys time for a source code fix (OWASP)
- Bridge WAF
- A request filter in front of the application, with three modes: off, monitor, block
- Better question
- Do you need to refuse requests at the edge, to see what the code does with them, or both?
What each one is
A web application firewall works on the conversation between client and server. It reads the method, path, headers, cookies and body, compares them with rules, and allows or refuses the request. The application never has to know it exists; it is usually deployed as a reverse proxy. OWASP’s own page says a WAF “applies a set of rules to an HTTP conversation” and that customising those rules can take significant effort and must be maintained as the application changes.
RASP moves the check into the application. A RASP product is normally an agent or library loaded into the same process as the code, so it is tied to a language and a runtime. Because it lives there, it can observe events a proxy cannot: the query that is about to reach the database, the file path about to be opened, the command about to be run. The decision is made at that moment, with the request and the code’s own behaviour both in view.
One caution about the word. RASP is a vendor-era term and products that carry it differ in what they hook and what they do on a detection. OWASP does have a related idea, AppSensor, which describes application layer intrusion detection and automated response and offers a toolkit for building self-defending applications. Read a product’s documentation for what it actually instruments before treating the label as a specification.
Side by side
| WAF | RASP | |
|---|---|---|
| Where it runs | In front of the application, on the request path | Inside the application process |
| What it sees | The HTTP request as it arrives | The request plus the calls the code makes while handling it |
| Changes needed in the application | None | An agent or library added to the runtime |
| Language dependence | None; it reads HTTP | Yes; support follows the runtime |
| Covers many applications at once | Yes, one place in front of them | Per application or per process |
| Typical failure | Refuses ordinary requests that look like attacks, or misses a request it parses differently from the application | Shares the process, so its faults and cost are the application’s |
| Fixes the code | No | No |
The last row is the one that does not move. Both are controls placed around a flaw. Neither removes it, and the comparison with a network device is on WAF vs firewall; the bundles that add API and bot defences around a WAF are weighed on WAF vs WAAP.
What only the inside can see
A filter in front of an application judges a string. What the application does with that string is a separate matter, and it is the part a request filter has no view of.
Take SQL injection. A WAF looks for suspicious content in the incoming parameters. A tool inside the process can look at the final statement the code builds and sends to the database, after every concatenation, decoding and framework transformation has happened. If the input was transformed somewhere between the edge and the query, only the second vantage point sees the finished result. The same reasoning applies to remote code execution: a request filter can match the shape of a known exploit request, while an in-process tool can see that the application is about to start a process or load a class it never normally does.
There is a second advantage that has nothing to do with attack content. Inside the application, a detection can carry context a proxy lacks: which function handled the request, which user was logged in, which code path ran. That is the idea behind AppSensor, where the application itself recognises misuse and responds.
The cost is the mirror image. The tool shares the application’s process, so its resource use and its faults are the application’s too. It has to exist for your language and framework. And it protects only the processes it was added to; an application nobody instrumented, or a forgotten legacy service, stays exactly as exposed as before.
What only the outside gives you
The filter’s advantages come from the same fact that limits it: it is not part of the application.
No change to the code or the runtime
Nothing is installed in the application. A rule can be added, switched to monitor mode or removed without a deployment of the application itself, and the same filter can stand in front of services written in different languages. That matters for software you cannot modify at all, such as a vendor product or an old system nobody wants to touch.
A bad request never reaches the code
A refused request is one the application does not parse, route or log as a normal event. A control inside the process, however well it reacts, reacts after the request has already been accepted and started to run.
Buying time for a known flaw
When a vulnerability is public and the fix is not yet deployed, a rule that refuses the exploit pattern is what virtual patching means. OWASP defines a virtual patch as “a security policy enforcement layer which prevents the exploitation of a known vulnerability” and says it is a work-around that buys time while source code fixes are made; it also notes that the patches that can be written fastest, which block known bad patterns, are the ones where evasion is more likely. Correcting the code remains the real remedy.
Where a WAF helps and where it does not
Bridge WAF is the first kind of control: a filter in front of the application, with a mode per domain. It is not RASP, it does not run in your code, and it is not offered here as a substitute for it.
What a request filter sees
Everything in the HTTP request, and nothing after it. It can refuse a request whose parameters match a rule, and it can apply per-domain rate limits to traffic that repeats. It records what it flagged in the activity log. The categories it is aimed at are mapped on the OWASP Top 10 page, together with the ones it cannot address.
What it does not see
It cannot see how your code handles an accepted request. Flawed authorisation logic, a business rule that can be abused with perfectly ordinary requests, and a flaw reached through input the rules do not recognise all look normal from outside. It also depends on reading a request the way the application will; where the two disagree about parsing, a rule can be stepped around, which is the subject of request smuggling. And it cannot repair anything: it filters requests; it does not fix code.
Three modes, and start with monitor
Bridge WAF has three modes only: off, monitor and block. In monitor the filter records what it would have refused and refuses nothing. Begin there. Read the log against real traffic, find the legitimate requests that match a rule, and handle those as false positives before block mode refuses anything. The routine is described on monitor mode. A tool inside the application has the same lesson in a different place: whatever it blocks, observe first.
Choosing, or combining
Nothing here depends on a product. It depends on which situation you are in.
- You cannot change the application, or run many of them. A filter in front is the practical shape, because it needs nothing from the code or the runtime.
- You own one application and need to know what its code is doing with input. Instrumentation inside the process answers questions a proxy cannot. Check that it supports your runtime and test what it costs under your own load, since that is not something to take from a brochure.
- You have both problems. They compose without conflict: the outside refuses what is plainly unwanted before it arrives, and the inside watches what the accepted traffic makes the code do. Neither replaces the other’s view.
- Either way, fix the code. Both are ways of holding a problem at a distance. The comparisons overview lists the other pairs that get mistaken for substitutes.
If a request filter is the part you need, Bridge WAF is included with Bridge CDN.
Questions
Is RASP a replacement for a WAF?
Not in general. They sit at different points: a WAF judges the request before the application handles it, and RASP watches what the code does while it handles it. Each sees something the other cannot, so the choice depends on whether you can instrument the application and whether you need to refuse traffic before it arrives.
Does a WAF need changes to my application?
No. A WAF sits in front of the application and reads HTTP, so the code and its runtime stay as they are. That is the main practical difference from RASP, which has to be loaded into the application's own runtime.
Can either one fix a vulnerability?
No. Both hold a flaw at a distance while it exists. OWASP describes virtual patching as a temporary work-around that buys time while source code fixes are made, and correcting the code is still the remedy.
Is Bridge WAF a RASP?
No. Bridge WAF is a request filter in front of the application, with three modes: off, monitor and block. It does not run inside your code and does not observe its internal calls.
Which should I deploy first?
Whichever matches the problem you can describe. If you cannot touch the code or you run several services, start with a filter in front and keep it in monitor mode until the log shows what it would refuse. If you own one application and need to see what its code does with input, instrumentation inside it answers that.