fix(interceptor): remove trusted-agent verification bypass to prevent false cryptographic endorsement (closes #5)#20
Conversation
|
Warning Review limit reached
Your plan currently allows 1 review/hour. Refill in 36 minutes and 42 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR removes a critical security bypass in the A2A verification interceptor that allowed trusted agents to skip the entire verification pipeline. Trusted agents now route through verification engines like all other senders, and fraud detection remains active regardless of sender trust status. ChangesTrusted Agent Bypass Removal
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Covers: - _load_trusted_agents(): env var parsing, empty entries, whitespace - get_interceptor(): singleton pattern, thread-safe creation - configure_interceptor(): atomic swap - GET /a2a/health: 200, correct fields - GET /a2a/metrics: 200, dict response - POST /a2a/intercept: 200, verdict fields, financial forward, 422 on bad payload, 503 on RuntimeError, 500 on unexpected error Overall coverage: 75% -> 89%
httpx is required by FastAPI's TestClient (via starlette). pytest-cov is required for coverage reporting in CI. Both were installed manually in CI steps but missing from [project.optional-dependencies.dev] — causing failures on clean pip install -e '.[dev]'.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Summary
This PR fixes critical trust-boundary issue #5 by removing the trusted-agent short-circuit in the interceptor.
Previously, if
sender_agent_idwas listed intrusted_agents, the interceptor returned early with:status=FORWARDEDengine_used="bypass"That behavior skipped all verification engines and could produce false cryptographic confidence.
This PR removes that bypass so trusted agents still pass through the normal verification pipeline.
Closes #5.
Changes
A2AVerificationInterceptor.intercept()src/qwed_a2a/interceptor.pytests/test_interceptor.pytest_trusted_agent_no_longer_bypasses_verificationtest_trusted_agent_financial_fraud_is_blockedBehavioral Impact
Before
Trusted sender could skip verification entirely and still get FORWARDED + JWT.
After
Trusted sender must still pass relevant verification engine checks.
finance_guard.engine="bypass"path removed from interceptor behavior.Verification
Executed:
Result:
Notes
This PR intentionally focuses only on #5 (trusted-agent bypass removal) to keep blast radius controlled and review straightforward. Other semantic/fail-closed issues remain tracked in separate issues.
Summary by CodeRabbit