Skip to content

fix(provenance): reject duplicate JSON keys, private JWKs, and non-dict records in check_server_provenance and validate required_kind in meets() (#813) - #818

Open
drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-provenance-813

Conversation

@drk-ram

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

Copy link
Copy Markdown

What

Reject duplicate JSON keys, NaN/Infinity, non-dict JSON records, and trusted_jwk dicts carrying private/symmetric key parameters in check_server_provenance, guard non-string kind/publisher fields, and validate required_kind in ProvenanceResult.meets.

Why

Closes #813.

Security impact

Prevents unhandled AttributeError/TypeError crashes on malformed server provenance files, prevents private key material in trusted_jwk, and ensures unknown required_kind values raise ValueError regardless of outcome.

Test plan

  • pytest passes (pytest tests/unit/test_provenance_consumption.py -q: 22 passed)
  • ruff check passes (All checks passed!)
  • mypy passes
  • Manual test performed

DCO sign-off

@github-actions

github-actions Bot commented Oct 25, 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 25, 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 b4ae1bdfa981a591080e5d7c93179f613fc2c398 in an isolated checkout.

Provenance-file parsing now handles malformed containers and ambiguous JSON as controlled invalid outcomes, refuses private/symmetric material in the supplied public trust anchor, and validates required assurance kinds. The focused controls pass here and expose missing baseline rejection/error handling when the baseline module is restored. No embedded signer key is promoted to an out-of-band trust anchor by this change.

Independent validation in a fresh repository-hash-locked Python 3.12.10 environment: 2,531 tests passed, 20 skipped; pip check, configured Ruff, mypy, Bandit and diff whitespace checks passed. Commit sign-offs are present. Hosted CI and applicable independent maintainer/security gates remain separate prerequisites to merge.

Reviewed with OpenAI Codex.

…ct records in check_server_provenance and validate required_kind in meets() (agentrust-io#813)

- Reject duplicate JSON object keys and non-finite JSON constants when parsing provenance files, and fail closed when the parsed root is not a JSON object or when any OSError/UnicodeDecodeError occurs.
- Reject private or symmetric JWK parameters in public_jwk before passing to verify_provenance_record.
- Validate required_kind against _ASSURANCE_RANK in ProvenanceCheckResult.meets().

Closes agentrust-io#813

Signed-off-by: Raghuvar Karthik Durga <177662415+drk-ram@users.noreply.github.com>
@drk-ram
drk-ram force-pushed the drk-ram-fix-provenance-813 branch from b4ae1bd to 417e073 Compare October 30, 2026 14:37

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

2 participants