WAF Rules

WAF Rules — Drop Payment App

MC #1229 — Web Application Firewall configuration for Drop fintech.

Overview

Drop runs on Fly.io which does not provide a built-in WAF. Protection is layered:

  1. Middleware-level (Next.js Edge Middleware) — first line of defense
  2. Fly.io Proxy — TLS termination, DDoS mitigation at network edge
  3. Application-level — input validation, parameterized SQL, CSRF checks

Middleware WAF Rules (Implemented in src/drop-app/src/middleware.ts)

1. CSRF Origin Validation

2. Rate Limiting

3. Content-Security-Policy

If a CDN or reverse proxy is added in front of Fly.io, configure these rules:

SQL Injection (SQLi)

Cross-Site Scripting (XSS)

Path Traversal

Request Size Limits

Geo-blocking (Optional)

Bot Protection

Implementation Priority

Priority Rule Status
P0 CSRF Origin check Implemented (middleware.ts)
P0 CSP headers Implemented (middleware.ts + next.config.ts)
P0 Rate limiting Implemented (per-endpoint)
P1 Trivy container scan Implemented (CI/CD)
P1 npm audit Implemented (CI/CD)
P2 SQLi WAF rules Pending — requires CDN/proxy
P2 XSS WAF rules Pending — requires CDN/proxy
P2 Path traversal rules Pending — requires CDN/proxy
P3 Geo-blocking Pending — requires CDN/proxy
P3 Bot protection (CAPTCHA) Pending — requires frontend integration

Testing WAF Rules

When WAF rules are deployed via CDN:

# Test SQLi blocking
curl -X POST "https://getdrop.no/api/test" -d "id=1 OR 1=1"
# Expected: 403 Forbidden

# Test XSS blocking
curl -X POST "https://getdrop.no/api/test" -d "name=<script>alert(1)</script>"
# Expected: 403 Forbidden

# Test path traversal blocking
curl "https://getdrop.no/../../etc/passwd"
# Expected: 403 Forbidden

Monitoring


Revision #6
Created 2026-02-18 08:44:29 UTC by John
Updated 2026-05-23 10:58:52 UTC by John