Skip to content

fix(delegation): reject private JWKs in trusted_root_keys, duplicate lattice entries, and invalid credential bounds (#647) - #649

Open
drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-delegation-context-647
Open

drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-delegation-context-647

Conversation

@drk-ram

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

Copy link
Copy Markdown
Contributor

What this changes

Closes #647.

Hardens _validate_context and verify_delegation_chain in src/agentrust_trace/delegation.py:

  • Rejects RFC 7517/7518 private or symmetric key parameters (d, p, q, dp, dq, qi, oth, k) on entries in context.trusted_root_keys without echoing secret values.
  • Bounds context.max_depth to JCS_SAFE_INTEGER (9007199254740991) and rejects duplicate entries in context.data_class_lattice.
  • Requires non-empty issuer and holder strings on each credential in context.credentials, bounds not_before and not_after to [0, JCS_SAFE_INTEGER], and requires not_before <= not_after.
  • Initializes visited = {id(current)} in verify_delegation_chain so a cycle returning to the leaf stops at the first return.

Validation commands and results:

  • PYTHONPATH=src python -m pytest tests/test_delegation_module.py tests/test_delegation_vectors.py -q -> passed (143 passed)
  • python -m ruff check src/agentrust_trace/delegation.py tests/test_delegation_module.py -> passed (All checks passed!)
  • PYTHONPATH=src python -m mypy src/agentrust_trace -> passed (Success: no issues found in 17 source files)
  • python tools/check_dashes.py -> passed (no dashes outside examples/, spec/trace-v0.1.md)
  • PYTHONPATH=src python tools/review_bar.py --base origin/main --head HEAD -> passed (18 changed test cases fail on behaviour at origin/main)

Type of change

  • Editorial (typo, link fix, clarification: no normative effect)
  • Non-breaking spec change (new optional field, new platform profile, informative addition)
  • Breaking spec change (requires 14-day comment period and Project Lead sign-off)
  • Schema change
  • Example addition

Spec section

src/agentrust_trace/delegation.py (informative A2A delegation chain profile; no normative change to spec/trace-v0.2.md)

Tests for a fix

  • _JWK_PRIVATE_PARAMS.intersection(jwk) check on context.trusted_root_keys: tests/test_delegation_module.py::test_verify_delegation_chain_rejects_private_jwk_members_in_trusted_root_keys
  • max_depth <= JCS_SAFE_INTEGER check: tests/test_delegation_module.py::test_verify_delegation_chain_rejects_max_depth_above_safe_int
  • len(set(lattice_list)) != len(lattice_list) check on context.data_class_lattice: tests/test_delegation_module.py::test_verify_delegation_chain_rejects_duplicate_data_class_lattice_entries
  • Non-empty credential issuer and holder, 0 <= val <= JCS_SAFE_INTEGER on not_before/not_after, and not_before <= not_after: tests/test_delegation_module.py::test_verify_delegation_chain_rejects_invalid_credential_identities_and_windows
  • visited: set[int] = {id(current)} initialization in verify_delegation_chain: tests/test_delegation_module.py::test_verify_delegation_chain_stops_at_first_return_to_leaf_in_cycle

Changelog entry

Checklist

  • DCO sign-off on all commits (git commit -s)
  • Breaking changes marked with <!-- CHANGED: #NNN: description --> in spec text
  • Backward compatibility statement included (for breaking changes)

…lattice entries, and invalid credential bounds (agentrust-io#647)

- Reject RFC 7517/7518 private or symmetric JWK parameters in context.trusted_root_keys without echoing secret values.
- Bound context.max_depth to JCS_SAFE_INTEGER and reject duplicate entries in context.data_class_lattice.
- Require non-empty credential issuer and holder strings, integer not_before and not_after in [0, JCS_SAFE_INTEGER], and not_before <= not_after.
- Seed visited with id(current) in verify_delegation_chain so a cycle returning to leaf terminates on the first return.

Closes agentrust-io#647

Signed-off-by: Raghuvar Karthik Durga <177662415+drk-ram@users.noreply.github.com>
@drk-ram
drk-ram requested review from a team, lywinged and rajnisht7 as code owners October 30, 2026 15:00
@github-actions

github-actions Bot commented Oct 30, 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 30, 2026
@rajnisht7

Copy link
Copy Markdown
Member

Batch response for this cluster is here: #653 (comment)

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:MEDIUM Contributor check flagged MEDIUM risk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(delegation): reject private JWKs in trusted_root_keys, duplicate lattice entries, and invalid credential bounds

2 participants