Skip to content

fix(delegation,attestation): enforce RFC 8785 safe-integer bounds and canonical lowercase hex on HolderProof and CallerPossession (#274) - #277

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

drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-delegation-attestation-274

Conversation

@drk-ram

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

Copy link
Copy Markdown

What

Enforce the RFC 8785 safe-integer ceiling (2**53 - 1) across DelegationCredential, verify_chain, RevocationStatement, and RevocationSnapshot, and enforce unknown-field rejection and canonical lowercase hex on HolderProof and CallerPossession.

Why

Closes #274.

Security impact

Prevents out-of-range integers (> 2**53 - 1) from bypassing DelegationCredential or RevocationSnapshot construction, prevents uppercase or whitespace-padded hex signatures in HolderProof, and prevents lone UTF-16 surrogates in CallerPossession.mac from raising an unhandled UnicodeEncodeError in verify_caller_possession.

Test plan

  • pytest passes (pytest tests/unit/test_holder_binding.py tests/unit/test_caller_offer_relay.py tests/unit/test_delegation.py tests/unit/test_revocation.py -q: 146 passed)
  • ruff check passes (ruff check src/ca2a_runtime/delegation/credential.py src/ca2a_runtime/delegation/revocation.py src/ca2a_runtime/delegation/holder.py src/ca2a_runtime/attestation.py tests/unit/test_holder_binding.py: All checks passed!)
  • mypy passes (mypy --strict src/ca2a_runtime/delegation/credential.py src/ca2a_runtime/delegation/revocation.py src/ca2a_runtime/delegation/holder.py src/ca2a_runtime/attestation.py: Success)
  • Manual test performed

DCO sign-off

@drk-ram
drk-ram requested review from a team, carloshvp and zohebk8s as code owners October 23, 2026 15:23
@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
carloshvp
carloshvp previously approved these changes Oct 24, 2026

@carloshvp carloshvp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head 252ac067f644908706c9dc34603d8ac947016975 in an isolated checkout.

Reviewed safe-integer checks at construction, parsing and evaluation boundaries, boolean exclusion, lowercase proof/MAC encodings and HolderProof's unknown-field rejection. The focused malformed-proof/numeric regression passes here and fails with the actual merge-base attestation/holder modules restored in process; valid holder-bound delegation tests remain passing.

Fresh hash-locked Python 3.12.10 validation: 781 unit tests passed, 16 skipped; pip check, Ruff, mypy, Bandit and diff whitespace checks passed. All commits have sign-offs. No blocking source finding in this scope; hosted checks and required security-maintainer approvals remain prerequisites.

Reviewed with OpenAI Codex.

@drk-ram drk-ram closed this Oct 29, 2026
@drk-ram
drk-ram force-pushed the drk-ram-fix-delegation-attestation-274 branch from 252ac06 to 1889ce4 Compare October 29, 2026 15:20
@drk-ram drk-ram reopened this Oct 29, 2026

@carloshvp carloshvp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed current head b5ff4de8b8b6acbb9faaad7a33d8e57c3c550bdf in an isolated checkout.

The scoped input-hardening behavior passes source review and the full local unit/conformance suite (837 passed, 16 skipped). Ruff lint, mypy, configured Bandit and dependency consistency pass; the commit is signed off.

The required ruff format --check src/ tests/ job still fails on this head, while the same command passes on current main. Please run the pinned formatter on src/ca2a_runtime/attestation.py, src/ca2a_runtime/delegation/revocation.py, tests/unit/test_holder_binding.py and rerun the format gate. The formatting diff is mechanical; no additional behavioral repair is requested by this review. Hosted CI and the independent security-review requirements still apply.

Reviewed with OpenAI Codex.

Copy link
Copy Markdown
Contributor

The requested formatting correction is ready for author adoption: dinakarjs#5, commit 9045ad6c41f18ab47ca0899727a072f1b6868097, based directly on this reviewed PR head. Pinned Ruff 0.17.1 formatting changes only; every changed Python AST is identical before/after. Final unit/conformance run: 851 passed, 2 skipped; Ruff format/lint, mypy, Bandit and whitespace checks pass. Environment and scope are recorded in the companion. Please cherry-pick into the existing PR and rerun hosted checks. This does not replace independent maintainer approval. DCO signed; prepared with Codex.

… canonical lowercase hex on HolderProof and CallerPossession (agentrust-io#274)

- Bound depth, not_before, not_after, at_time, max_revocation_staleness, issued_at, and as_of by _MAX_SAFE_INTEGER (2**53 - 1) and validate depth in DelegationCredential.__post_init__.
- Reject unknown fields and enforce 128-character lowercase hex on HolderProof.signature in HolderProof.from_dict and verify_holder_proof.
- Reject unknown fields and enforce 64-character lowercase hex on CallerPossession.mac in CallerPossession.from_dict and verify_caller_possession.

Closes agentrust-io#274

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

drk-ram commented Oct 31, 2026

Copy link
Copy Markdown
Author

@carloshvp Amended and force-pushed e7008a1 (e7008a1881da68f0765b9deef3f3fe16fc9f2e38). ruff format --check src/ tests/ and ruff check src/ tests/ now pass with 0 errors.

@drk-ram
drk-ram force-pushed the drk-ram-fix-delegation-attestation-274 branch from b5ff4de to e7008a1 Compare October 31, 2026 15:08

@carloshvp carloshvp left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed commit e7008a1881da68f0765b9deef3f3fe16fc9f2e38.

The requested formatting repair is complete. I compared the changed Python files with the revision from my prior review: their parsed ASTs are identical. The pinned repository formatter, Ruff, mypy and configured Bandit pass on this head. Focused tests: 35 passed (the HTTP replay case passed with loopback access after the sandbox refused its test socket).

This resolves my formatting change request. The existing security impact and independent maintainer/CI requirements remain applicable.

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,attestation): enforce RFC 8785 safe-integer bounds and canonical lowercase hex on HolderProof and CallerPossession

3 participants