Skip to content

fix(examples): reject duplicate JSON keys, non-finite numbers, and boolean sequences in verify_receipts and verify_purchase (#369) - #373

Open
drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-examples-369
Open

drk-ram wants to merge 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-examples-369

Conversation

@drk-ram

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

Copy link
Copy Markdown

Summary

  • Reject duplicate JSON object keys and NaN/Infinity constants, pass allow_nan=False, and require type(receipt["sequence"]) is int in examples/embodied-action-receipts/verify_receipts.py.
  • Guard non-dict sections, enforce safe-integer bounds (<= 2**53 - 1) on amount_minor and max_amount_minor, and reject duplicate JSON keys and NaN/Infinity in examples/agentic-commerce-accountability/verify_purchase.py.

Closes #369

Validation

  • python -m pytest examples/embodied-action-receipts/tests/test_verify_receipts.py examples/agentic-commerce-accountability/tests/test_verify_purchase.py -q

@drk-ram
drk-ram requested review from a team, carloshvp and imran-siddique as code owners October 23, 2026 23:08
@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
…olean sequences in verify_receipts and verify_purchase (agentrust-io#369)

- Reject duplicate JSON object keys and NaN/Infinity constants, pass allow_nan=False, and require integer receipt sequence numbers in examples/embodied-action-receipts/verify_receipts.py.
- Guard non-dict sections, enforce safe-integer bounds on amount_minor and max_amount_minor, and reject duplicate JSON keys and NaN/Infinity in examples/agentic-commerce-accountability/verify_purchase.py.

Closes agentrust-io#369

Signed-off-by: Raghuvar Durga <177662415+drk-ram@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@drk-ram
drk-ram force-pushed the drk-ram-fix-examples-369 branch from 2638393 to 6e60236 Compare October 23, 2026 23:09

@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 6e60236cdde1a907e7430049c263b32bc1b17f0b in an isolated checkout.

The example verifiers now reject ambiguous/non-finite JSON, boolean receipt sequence numbers, malformed purchase sections and non-integer/out-of-range minor-unit amounts while preserving the existing signed receipt and purchase fixtures. These checks establish the example's evidence/structure contract, not physical completion.

Validation: 9 receipt tests with 12 subtests and 8 purchase tests with 9 subtests passed. The repository's actual hosted Ruff subset (integrations/packages/scripts/tests/claude-code/copilot/plugins/scheduled-agents/shadow-ai; E4,E7,E9,F) and diff whitespace checks passed. An additional optional lint of the example tree reports two pre-existing E402 imports after its sys.path setup; that is outside the hosted subset and is not introduced here. Sign-offs are present. No blocking source finding; hosted CI and maintainer policy remain separate.

Reviewed with OpenAI Codex.

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(examples): reject duplicate JSON keys, non-finite numbers, and boolean sequences in verify_receipts and verify_purchase

2 participants