Commit 718d830
Jenkins
feat: add real-time streaming security analysis (Loop 30)
Incremental regex-based security analysis during SSE streaming:
- Add StreamingSecurityMonitor that runs lightweight pattern checks
every N tokens (configurable, default 50) during SSE streaming
- Detect injection patterns, PII, and data leakage mid-stream before
the response completes — early warning layer
- Fire alerts for critical findings mid-stream via the alert engine
(don't wait for stream completion)
- Tag all streaming findings with "detection": "streaming" metadata
so consumers can distinguish from full post-stream analysis
- Add StreamingAnalysisConfig (streaming_analysis.enabled,
streaming_analysis.token_interval) to ProxyConfig
- Expose RegexSecurityAnalyzer pattern methods publicly for direct
synchronous use by the streaming monitor
- Full post-stream analysis still runs after completion (unchanged)
- 13 new tests covering: mid-stream injection/PII/leakage detection,
streaming metadata tagging, delta-only analysis, interval behavior,
findings draining, multi-finding detection, edge cases
- Update config.example.yaml with streaming_analysis section1 parent 5746cd4 commit 718d830
6 files changed
Lines changed: 542 additions & 5 deletions
File tree
- crates
- llmtrace-core/src
- llmtrace-proxy/src
- llmtrace-security/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
207 | 222 | | |
208 | 223 | | |
209 | 224 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
847 | 847 | | |
848 | 848 | | |
849 | 849 | | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
850 | 853 | | |
851 | 854 | | |
852 | 855 | | |
| |||
879 | 882 | | |
880 | 883 | | |
881 | 884 | | |
| 885 | + | |
882 | 886 | | |
883 | 887 | | |
884 | 888 | | |
| |||
1237 | 1241 | | |
1238 | 1242 | | |
1239 | 1243 | | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
1240 | 1281 | | |
1241 | 1282 | | |
1242 | 1283 | | |
| |||
2197 | 2238 | | |
2198 | 2239 | | |
2199 | 2240 | | |
| 2241 | + | |
2200 | 2242 | | |
2201 | 2243 | | |
2202 | 2244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
363 | 370 | | |
364 | 371 | | |
365 | 372 | | |
| |||
373 | 380 | | |
374 | 381 | | |
375 | 382 | | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
376 | 403 | | |
377 | 404 | | |
378 | 405 | | |
| |||
390 | 417 | | |
391 | 418 | | |
392 | 419 | | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
393 | 443 | | |
394 | 444 | | |
395 | 445 | | |
| |||
454 | 504 | | |
455 | 505 | | |
456 | 506 | | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
457 | 512 | | |
458 | 513 | | |
459 | 514 | | |
| |||
0 commit comments