Repository navigation
fix(examples): reject duplicate JSON keys, non-finite numbers, and boolean sequences in verify_receipts and verify_purchase (#369) - #373
Conversation
|
🟡 Contributor Check: MEDIUM
Automated check by AgenTrust Contributor Check. |
…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>
2638393 to
6e60236
Compare
carloshvp
left a comment
There was a problem hiding this comment.
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.
Summary
NaN/Infinityconstants, passallow_nan=False, and requiretype(receipt["sequence"]) is intinexamples/embodied-action-receipts/verify_receipts.py.<= 2**53 - 1) onamount_minorandmax_amount_minor, and reject duplicate JSON keys andNaN/Infinityinexamples/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