Skip to content

fix(verify,runtime): reject private JWK members, non-canonical base64url, lone surrogates, duplicate JSON keys, and future revocation snapshots - #268

Closed
drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-verify-runtime-hardening-267
Closed

drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-verify-runtime-hardening-267

Conversation

@drk-ram

@drk-ram drk-ram commented Oct 23, 2026

Copy link
Copy Markdown

What

Hardens cryptographic key parsing, RFC 8785 canonicalization, JSON file loading, and revocation snapshot freshness enforcement across ca2a_verify and ca2a_runtime:

  1. Rejects RFC 7517 / RFC 7518 / RFC 8037 private or symmetric JWK members (d, p, q, dp, dq, qi, oth, k) and enforces canonical unpadded 32-byte base64url public keys in src/ca2a_verify/dag.py and src/ca2a_runtime/agent_manifest.py.
  2. Rejects lone UTF-16 surrogates (U+D800..U+DFFF) in src/ca2a_runtime/canonical.py string values and object keys with a deterministic ValueError instead of leaking UnicodeEncodeError.
  3. Rejects duplicate JSON object keys via object_pairs_hook in src/ca2a_verify/verify.py when loading delegation chain and revocation files.
  4. Raises RevocationStatusUnknown in src/ca2a_runtime/delegation/credential.py when max_revocation_staleness is set and RevocationSnapshot.as_of > now.

Why

Closes #267.

Security impact

Touches src/ca2a_verify/ and src/ca2a_runtime/delegation/:

  • Prevents private or symmetric JWK key material from being accepted in public verification JWKs or Agent Manifest trust anchors, and blocks non-canonical base64url key representations (padding, standard base64 alphabet characters, non-zero trailing bits, or non-32-byte Ed25519 keys).
  • Enforces RFC 8785 I-JSON lone-surrogate rejection with a deterministic ValueError during canonical signing/verification.
  • Prevents JSON key-shadowing ambiguities in offline chain and revocation verification files.
  • Prevents a future-dated RevocationSnapshot.as_of from producing a negative now - revocations.as_of delta that bypasses max_revocation_staleness indefinitely.

Test plan

  • pytest passes (pytest tests/ -q — 875 passed, 16 skipped)
  • ruff check passes (ruff check src/ tests/ — All checks passed!)
  • mypy passes (mypy src/ca2a_runtime/ src/ca2a_verify/ — Success: no issues found in 47 source files)
  • Manual test performed (describe steps below if applicable)

Verified counterfactual failures for all four fixes when each guard is disabled, and ran bandit -r src/ -c pyproject.toml with zero issues.

DCO sign-off

…url, lone surrogates, duplicate JSON keys, and future revocation snapshots

- Reject RFC 7517/7518/8037 private or symmetric JWK members (d, p, q, dp,
  dq, qi, oth, k) and enforce canonical unpadded 32-byte base64url public
  keys in ca2a_verify.dag and ca2a_runtime.agent_manifest.
- Reject lone UTF-16 surrogates (U+D800..U+DFFF) in ca2a_runtime.canonical
  string values and object keys with a deterministic ValueError.
- Reject duplicate JSON object keys via object_pairs_hook in
  ca2a_verify.verify when loading chain and revocation files.
- Raise RevocationStatusUnknown when max_revocation_staleness is configured
  and RevocationSnapshot.as_of is in the future relative to evaluation time.

Closes agentrust-io#267

Signed-off-by: Raghuvar Durga <177662415+drk-ram@users.noreply.github.com>
Co-authored-by: Raghuvar Durga <177662415+drk-ram@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Raghuvar Durga <177662415+drk-ram@users.noreply.github.com>
@drk-ram
drk-ram requested review from a team, carloshvp and zohebk8s as code owners October 23, 2026 01:43
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for this, @drk-ram. Closing it for now, and it is not about the change itself.

This repository asks first-time contributors to be vouched by a maintainer before opening a pull request. That is because agent-written contributions are easy to produce and expensive to review, and we would rather talk to you first than review something neither of us can explain.

To get vouched: open an issue saying what you want to change and why, in your own words. A maintainer will reply, and add you with /vouch. After that, reopen this pull request or open a new one.

See CONTRIBUTING.md for the detail.

@github-actions github-actions Bot closed this Oct 23, 2026
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Contributor Check: MEDIUM

Check Result
Profile MEDIUM
Credential LOW
Overall MEDIUM

Automated check by AgenTrust Contributor Check.

@github-actions github-actions Bot added the needs-review:MEDIUM Contributor check flagged MEDIUM risk label Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review:MEDIUM Contributor check flagged MEDIUM risk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(verify,runtime): reject private JWK members, non-canonical base64url, lone surrogates, duplicate JSON keys, and future revocation snapshots

1 participant