Skip to content

fix(inspection): bound AGT scanner calls with timeout; add scanner attribution (INJECT-002, INJECT-003) - #229

Merged
imran-siddique merged 1 commit into
mainfrom
fix/inject-002-003-scanner-timeout-audit
Jun 7, 2026
Merged

fix(inspection): bound AGT scanner calls with timeout; add scanner attribution (INJECT-002, INJECT-003)#229
imran-siddique merged 1 commit into
mainfrom
fix/inject-002-003-scanner-timeout-audit

Conversation

@imran-siddique

Copy link
Copy Markdown
Member

Summary

  • INJECT-002: wraps scan_response() and PromptInjectionDetector.detect() in ThreadPoolExecutor.submit(...).result(timeout=N). Default timeout is 5.0 seconds, configurable via InspectionPipeline(scanner_timeout_seconds=...). A timeout is treated as deny (fail-safe) — a slow or unresponsive AGT service cannot exhaust worker slots indefinitely
  • INJECT-003: adds injection_scanner: str | None and injection_score: float | None to both StageResult and InspectionResult. Values: "agt_mcp", "agt_detector", "regex", "timeout", "utf8_guard". Callers writing audit chain entries now have the specific scanner that triggered a deny plus the confidence score if the AGT detector provided one

Test plan

  • pytest tests/unit/test_inspection.py -v — 31 passed (8 new tests)
  • pytest tests/unit/ -q — 401 passed

Closes #169
Closes #170

🤖 Generated with Claude Code

…tribution to result

INJECT-002: wraps scan_response() and PromptInjectionDetector.detect() in
ThreadPoolExecutor with a configurable timeout (default 5s). A timeout is
treated as deny (fail-safe) so a slow/unresponsive AGT service cannot
exhaust worker slots indefinitely.

INJECT-003: adds injection_scanner and injection_score fields to
InspectionResult and StageResult. Callers writing audit chain entries now
have the specific scanner that triggered the deny ("agt_mcp", "agt_detector",
"regex", "timeout", "utf8_guard") and confidence score if available.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@imran-siddique
imran-siddique merged commit 5fd39c1 into main Jun 7, 2026
1 of 8 checks passed
imran-siddique added a commit that referenced this pull request Jun 7, 2026
…tribution to result (#229)

INJECT-002: wraps scan_response() and PromptInjectionDetector.detect() in
ThreadPoolExecutor with a configurable timeout (default 5s). A timeout is
treated as deny (fail-safe) so a slow/unresponsive AGT service cannot
exhaust worker slots indefinitely.

INJECT-003: adds injection_scanner and injection_score fields to
InspectionResult and StageResult. Callers writing audit chain entries now
have the specific scanner that triggered the deny ("agt_mcp", "agt_detector",
"regex", "timeout", "utf8_guard") and confidence score if available.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@imran-siddique
imran-siddique deleted the fix/inject-002-003-scanner-timeout-audit branch July 29, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant