fix(security): deduplicate deny reasons, configurable cleanup, injection threshold audit, redact auth header - #249
Merged
Conversation
This was referenced Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
deny_reasonswithdict.fromkeys()before computingfinalverdict inInspectionPipeline, so the audit record reflects distinct policy firings rather than duplicated entries from overlapping code paths.CMCP_SESSION_CLEANUP_INTERVAL_SECONDSenv var (int, default 60) as a class attribute onSessionManagerand an instance attribute onMCPServer, making the cleanup timer configurable without code changes.injection_thresholdfromAGT MCPResponseScannerthroughproxy.pyinto theinjection_detailaudit dict, so downstream consumers can replay the allow/deny decision under config changes._redact_auth_headers()tocmcp_verify/opaque.pyand use it in all debug log calls; addOPAQUE_API_KEYenv var support that injects aBearertoken into Opaque attestation requests without ever logging the raw value.Test plan
tests/unit/test_low_batch_186_187_191_194.py— 15 new unit tests, all passing locallytest_deny_reasons_deduplication/test_deny_reasons_single_entry/test_deny_reasons_empty(POLICY-008)test_session_manager_cleanup_interval_default/test_session_manager_cleanup_interval_from_env/test_mcp_server_cleanup_interval_default/test_mcp_server_cleanup_interval_from_env(AUTH-004)test_injection_threshold_present_for_deny/test_injection_threshold_strict/test_injection_threshold_permissive/test_agt_mcp_scanner_deny_includes_threshold(INJECT-007)test_redact_auth_headers_redacts_authorization/test_redact_auth_headers_case_insensitive/test_redact_auth_headers_no_auth_unchanged/test_opaque_api_key_not_logged_on_failure/test_opaque_verify_sends_api_key_as_bearer(HW-008)pytest tests/unit/— pre-existing failures intest_benchmarks,test_tee_dev_mode_freeze,test_tee_providersare unrelated to this PR🤖 Generated with Claude Code