← Back to appsec.fyi

WAF vs RASP

One guards the perimeter. The other guards the runtime. Both have blind spots.

WAFRASP
PositionNetwork edge, in front of the appInside the application runtime
VisibilityHTTP requests and responses onlyFull application context + data flow
Protection modelPattern matching, signatures, rulesCode-level analysis of data flow
DOM XSS detectionCannot see it (client-side only)Can detect if JS engine is instrumented
False positivesHigher — no application contextLower — sees actual code behavior
DeploymentReverse proxy or CDN integrationLanguage-specific agent in the app
Performance impactMinimal — separate from appSome overhead — runs in-process

WAF

Web Application Firewalls sit between users and your application. They inspect HTTP traffic against rules and signatures — blocking known attack patterns like SQLi payloads and XSS vectors. They're easy to deploy (often just a DNS change for cloud WAFs) and protect without code changes. The limitation is they only see HTTP and lack application context, leading to bypasses and false positives.

RASP

Runtime Application Self-Protection instruments the application from inside. It sees the full data flow — from HTTP input through code execution to database queries. If a SQL string built from user input reaches a query, RASP catches it regardless of encoding or obfuscation tricks that bypass WAFs. The cost is language-specific agents and production runtime overhead.

Together

WAFs are your first line — they block the obvious attacks and reduce noise. RASP catches what gets through, especially encoded payloads and business logic attacks the WAF can't understand. Defense in depth means running both rather than choosing one.

More comparisons: SSRF vs CSRF XSS vs CSRF XSS Types AuthN vs AuthZ IDOR vs BOLA SQLi vs NoSQLi SAST vs DAST Bounty vs Pentest SBOM vs SLSA Validation vs Encoding DAST vs IAST vs RASP SCA vs SAST OAuth vs SAML Pentest vs Red Team