Commit aa1a399
committed
feat(synapse-waf): demo simulator with procedural attacker archetypes (Phase 1)
Adds src/simulator.rs — a tokio background task that procedurally
generates HTTP requests from attacker archetypes and feeds them through
the REAL WAF detection engine + real shared managers (EntityManager,
CampaignManager, BlockLog, WafStats). When the binary is run with --demo,
the simulator populates these managers from synthetic traffic, so the
admin endpoints horizon already polls (/sensor/status, /sensor/entities,
/sensor/campaigns) serve live-looking data without needing a real
network sensor in front of the proxy.
Two archetypes ship in Phase 1:
- CredentialStuffer: 20 source IPs sharing a Go-client JA4 fingerprint,
rotating usernames against /api/login. Exercises CampaignManager's
JA4-cluster correlation; the dashboard sees a real campaign emerge.
- VulnScanner: single IP, sqlmap UA, classic SQLi/XSS/path-traversal/
command-injection payloads against varied URIs. Trips production
rules (200200, 280001 etc.) and accumulates entity risk to 100.0.
The simulator does NOT touch the production filter chain — it calls
DetectionEngine::analyze_with_signals directly and mirrors the small
set of post-analyze state updates request_filter normally does. This
seam is documented inline; the long-term cleanup is to extract a
process_request_state helper both paths call.
admin_server: removes 4 hardcoded short-circuits in sites/status/
entities/campaigns handlers so the real handler path serves
simulator-populated data when --demo is set. The demo_*() helpers are
retained as fallbacks for the brief window between startup and the
first simulator tick.
Smoke test (10s of runtime): waf.analyzed=140 blocked=20 blockRate=14.3%,
entity 203.0.113.99 risk=100.0, real campaign with confidence=100.1 parent 121f57e commit aa1a399
3 files changed
Lines changed: 551 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1725 | 1725 | | |
1726 | 1726 | | |
1727 | 1727 | | |
1728 | | - | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
1729 | 1736 | | |
1730 | | - | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
1731 | 1751 | | |
1732 | | - | |
1733 | | - | |
1734 | 1752 | | |
1735 | 1753 | | |
1736 | 1754 | | |
| |||
2112 | 2130 | | |
2113 | 2131 | | |
2114 | 2132 | | |
2115 | | - | |
2116 | | - | |
2117 | | - | |
2118 | | - | |
2119 | | - | |
| 2133 | + | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
| 2137 | + | |
2120 | 2138 | | |
2121 | 2139 | | |
2122 | 2140 | | |
| |||
2196 | 2214 | | |
2197 | 2215 | | |
2198 | 2216 | | |
2199 | | - | |
2200 | | - | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
2201 | 2226 | | |
2202 | 2227 | | |
2203 | 2228 | | |
2204 | | - | |
2205 | | - | |
2206 | 2229 | | |
2207 | 2230 | | |
2208 | 2231 | | |
| |||
2889 | 2912 | | |
2890 | 2913 | | |
2891 | 2914 | | |
2892 | | - | |
2893 | | - | |
2894 | | - | |
2895 | | - | |
2896 | | - | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
2897 | 2918 | | |
2898 | 2919 | | |
2899 | 2920 | | |
| |||
2919 | 2940 | | |
2920 | 2941 | | |
2921 | 2942 | | |
| 2943 | + | |
| 2944 | + | |
| 2945 | + | |
| 2946 | + | |
| 2947 | + | |
2922 | 2948 | | |
2923 | 2949 | | |
2924 | 2950 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
| |||
6305 | 6310 | | |
6306 | 6311 | | |
6307 | 6312 | | |
| 6313 | + | |
| 6314 | + | |
| 6315 | + | |
| 6316 | + | |
| 6317 | + | |
| 6318 | + | |
| 6319 | + | |
| 6320 | + | |
| 6321 | + | |
| 6322 | + | |
| 6323 | + | |
| 6324 | + | |
| 6325 | + | |
| 6326 | + | |
| 6327 | + | |
| 6328 | + | |
| 6329 | + | |
| 6330 | + | |
| 6331 | + | |
| 6332 | + | |
| 6333 | + | |
| 6334 | + | |
| 6335 | + | |
| 6336 | + | |
| 6337 | + | |
| 6338 | + | |
| 6339 | + | |
| 6340 | + | |
| 6341 | + | |
| 6342 | + | |
| 6343 | + | |
| 6344 | + | |
6308 | 6345 | | |
6309 | 6346 | | |
6310 | 6347 | | |
| |||
0 commit comments