Commit 244af9d
committed
feat: add runtime content scanning for worker pipelines (t1412.4)
Add scan-stdin integration into worker dispatch infrastructure with three
performance/security improvements adopted from stackoneHQ/defender:
1. Keyword pre-filter: fast rejection of clean content before expensive
regex matching (~100x speedup for the common case)
2. NFKC Unicode normalization: closes fullwidth/mathematical/modifier
character bypasses before pattern matching
3. Boundary annotation: wraps untrusted content in [UNTRUSTED-DATA-{uuid}]
tags so the LLM knows trust boundaries
New files:
- runtime-scan-helper.sh: content-type-aware scanning wrapper with
structured audit logging, per-type policies (strict for PR diffs/issues,
permissive for file reads), and boundary annotation via wrap command
- scan-content command in prompt-guard-helper.sh: structured JSON output
with source metadata for programmatic consumption
Integration:
- cron-dispatch.sh: scans task descriptions before dispatching to workers,
prepends injection warning if patterns detected
- build.txt: documents runtime-scan-helper.sh usage for agents
- prompt-injection-defender.md: full documentation of runtime scanning
architecture, content types, audit logging, and dispatch integration
Closes #30741 parent e32be87 commit 244af9d
5 files changed
Lines changed: 1742 additions & 16 deletions
File tree
- .agents
- prompts
- scripts
- tools/security
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
| 154 | + | |
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
163 | 164 | | |
164 | 165 | | |
165 | 166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
33 | 38 | | |
34 | 39 | | |
35 | 40 | | |
| |||
355 | 360 | | |
356 | 361 | | |
357 | 362 | | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
358 | 390 | | |
359 | 391 | | |
360 | 392 | | |
| |||
0 commit comments