fix(security): fail closed without attestations#21
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughHidden review stack artifact:WalkthroughThe PR converts JWT attestation from optional (gracefully disabled when dependencies are missing) to mandatory fail-closed enforcement. The interceptor now raises at startup if ChangesJWT Attestation Fail-Closed Enforcement
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7081614485
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
| attestation_jwt = self.crypto.sign_verdict( | ||
| trace_id=trace_id, | ||
| verdict_status=status.value, | ||
| engine=engine, | ||
| sender_id=message.sender_agent_id, |
There was a problem hiding this comment.
Validate signer output before returning a verdict
The fail-closed change still accepts any non-exception return from sign_verdict, so an injected crypto_service that returns None or an empty string on soft failure will emit a normal VerificationVerdict with a missing/invalid attestation. This directly violates the new “never emit unsigned verdicts” guarantee and can happen in real deployments that provide a custom signer wrapper. Treat falsy/invalid token output as a signing failure and raise instead of returning the verdict.
Useful? React with 👍 / 👎.
|
Hey Sarvesh Agarwal (@sarvesh1327) , nice work on this....the startup RuntimeError and the signing One thing before we merge: the Codex suggestion is still open. Right now Can you add a check after the sign_verdict call? And a test for it......something like your FailingCryptoService but returning Once that's in, this is good to go. |
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
|
Thanks for the contribution Sarvesh Agarwal (@sarvesh1327), especially the follow-up fix for empty attestation tokens and the regression coverage. The fail-closed path is much stronger now. And yeah, the CI workflow conflict was actually on our side since we restructured Sonar/Snyk workflows after your fork/PR branch was already created, so no worries there. Merged. Feel free to contribute again in future if something in the QWED ecosystem aligns with your interests, especially around agent security, trust boundaries, verification semantics, or infra hardening. Thank you so much again. |
91f2fc6
into
QWED-AI:main
Summary
attestation_jwt=Nonefrom being emitted silently.Test Plan
PYTHONPATH=src python3 -m pytest tests/test_interceptor.py -qPYTHONPATH=src python3 -m pytest tests/ -qPYTHONPATH=src python3 -m compileall -q src testspython3 -m ruff check src/qwed_a2a/interceptor.py tests/test_interceptor.pyNote:
python3 -m ruff check .still reports pre-existing unused imports in untouched files (security/crypto.py,security/trust_boundary.py, andtests/test_crypto_signing.py).Closes #7
Summary by CodeRabbit
Bug Fixes
Documentation
Tests