fix(agent-manifest): wire runtime enforcement_mode into manifest verification - #584
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
This PR depends upon agentrust-io/agent-manifest#345, tested locally against the patched SDK and confirmed CI turns fully green once that merges (verified the exact 2 failing tests pass, plus re-ran the full related test suite). One more thing found while tracing this: |
|
One required release fix before approval: please change �gent-manifest>=0.11.1 to �gent-manifest>=0.11.2 in pyproject.toml. This PR passes �nforcement_mode= to VerificationContext, but 0.11.1 has no such field; leaving the old floor permits a metadata-valid install that fails on the new verification path. 0.11.2 is now published and contains agentrust-io/agent-manifest#345. Once that one-line floor update lands, I’ll re-review the refreshed green head and merge. |
|
Correction to the formatting in my previous comment: change the dependency requirement from agent-manifest>=0.11.1 to agent-manifest>=0.11.2 in pyproject.toml. Version 0.11.2 is now published. This floor is required because VerificationContext(enforcement_mode=...) is not supported by 0.11.1. |
imran-siddique
left a comment
There was a problem hiding this comment.
Verified the enforcement-mode binding against agent-manifest 0.11.2. Local evidence: 1,492 passed, 8 skipped; Ruff clean; mypy clean across 65 source files. Dependency floor now matches the required SDK API and behavior.
What
Adds a runtime enforcement-mode cross-check to Agent Manifest binding verification. Previously only the policy_bundle hash was checked against the manifest in the runtime's actual enforcement mode (enforce / advisory / audit-only) and was never verified against what the manifest declares, so a runtime could silently run in a weaker mode than its manifest requires while still passing verification.
kindly merge this after agentrust-io/agent-manifest#345
Why
Fixes: #576
A manifest's policy_bundle can declare enforcement_mode: "enforce", but cMCP never checked the running instance was actually attested as being in that mode. Same approved policy bundle, same hash match, but the runtime could be configured for advisory (warn-only, doesn't block) or silent, and verify_agent_manifest_binding would still report success. This closes that gap: cMCP now passes its own config.attestation.enforcement_mode into the verification call (via a small mapping, since cMCP's own vocabulary enforcing / advisory / silent that doesn't match the Agent Manifest spec's enforce / advisory / audit-only), and a mismatch (or an unattested mode when the manifest requires one) now fails closed instead of passing silently.
Companion fix in agentrust-io/agent-manifest (adds the enforcement_mode field and cross-check to VerificationContext / verify_manifest this PR is the cMCP-side consumer of that).
Security impact
Yes. This touches capability/policy enforcement verification.
Test plan
pytestpassesruff checkpassesmypypassesExecuted:
pytest tests/unit/test_agent_manifest.py tests/unit/test_agent_manifest_cose.py -q
ruff check src/cmcp_runtime/agent_manifest.py src/cmcp_runtime/startup.py tests/unit/test_agent_manifest.py tests/unit/test_agent_manifest_cose.py
mypy src/cmcp_runtime/agent_manifest.py src/cmcp_runtime/startup.py
DCO sign-off
Developer Certificate of Origin (https://developercertificate.org).