Skip to content

fix(security): reject non-UTF-8 responses and fix injection tracking - #199

Merged
imran-siddique merged 1 commit into
mainfrom
fix/security-critical-injection-tracking
Jun 6, 2026
Merged

imran-siddique merged 1 commit into
mainfrom
fix/security-critical-injection-tracking

Conversation

@imran-siddique

Copy link
Copy Markdown
Member

Summary

Test plan

  • test_pipeline_denies_non_utf8_response — non-UTF-8 payload → deny with non-utf8-response pattern
  • test_pipeline_non_utf8_calls_session_update_with_injection_detectedinjection_detected=True on non-UTF-8 path
  • test_agt_mcp_scanner_deny_sets_injection_detected_on_session — AGT MCP scanner deny sets injection_detected=True on session
  • test_agt_mcp_scanner_deny_is_not_overwritten_by_regex_allow — final decision is "deny" even when regex stage returns "allow"
  • All 232 tests pass

🤖 Generated with Claude Code

Closes #154, #155, #156.

INJECT-005: Decode response bytes with errors="strict" before injection
scanning. Non-UTF-8 payloads are rejected with injection_pattern=
"non-utf8-response" to prevent bypass via byte sequences that
errors="replace" would silently corrupt before pattern matching.

POLICY-006 / INJECT-004: AGT MCPResponseScanner denial no longer
overwritten by a subsequent regex-stage allow. injection_detected flag
now reflects both scanners so session.update_from_inspection() always
records InjectionEvent when either scanner fires.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@imran-siddique
imran-siddique merged commit c0035cc into main Jun 6, 2026
7 checks passed
@imran-siddique
imran-siddique deleted the fix/security-critical-injection-tracking branch June 6, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment