Skip to content

fix(trace,catalog): canonicalize TRACE claims and catalog hashes with RFC 8785 JCS (#837) - #838

Open
drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:fix-jcs-trace-hashes
Open

drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:fix-jcs-trace-hashes

Conversation

@drk-ram

@drk-ram drk-ram commented Nov 6, 2026

Copy link
Copy Markdown

What

Canonicalize TRACE claim signing inputs, claim digests, and tool catalog/definition SHA-256 hashes with RFC 8785 (JCS) instead of json.dumps(..., ensure_ascii=True).

Why

json.dumps(..., sort_keys=True, separators=(",", ":")) defaults to ensure_ascii=True, escaping non-ASCII UTF-8 code points to \uXXXX and formatting floating-point values using Python's repr rather than RFC 8785 Section 3.2.2.3. That caused TRACE claims and catalog hashes containing non-ASCII or float values to diverge from JCS verifiers.

Closes #837

Security impact

Restores RFC 8785 (JCS) canonicalization across cmcp_runtime.audit.trace_claim, cmcp_runtime.catalog.loader, cmcp_runtime.session.manager, and cmcp_verify, preventing cross-verifier signature and digest mismatches on non-ASCII or numeric claims.

Test plan

  • pytest passes (pytest tests/unit/test_trace_claim.py tests/unit/test_catalog_jcs_hashes.py tests/unit/test_session_manager.py tests/unit/test_kill_switch.py tests/unit/test_verify.py — 165 passed)
  • ruff check passes (ruff check src tests — passed)
  • mypy passes (mypy src — passed)
  • Manual test performed (describe steps below if applicable)

DCO sign-off

  • My commits include Signed-off-by: (git commit -s)

Signed-off-by: Raghuvar Karthik Durga <177662415+drk-ram@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

🔴 Contributor Check: HIGH

Check Result
Profile HIGH
Credential LOW
Overall HIGH

Automated check by AgenTrust Contributor Check.

@github-actions github-actions Bot added the needs-review:HIGH Contributor check flagged HIGH risk label Nov 6, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review:HIGH Contributor check flagged HIGH risk

Projects

None yet

1 participant