Skip to content

fix: reject nonstandard JSON when wrapping evidence - #260

Merged
bruceweygandt merged 3 commits into
paramify:mainfrom
togofishicorn:togofish/strict-envelope-json
Nov 10, 2026
Merged

bruceweygandt merged 3 commits into
paramify:mainfrom
togofishicorn:togofish/strict-envelope-json

Conversation

@togofishicorn

Copy link
Copy Markdown
Contributor

Python's default JSON decoder accepts NaN/Infinity, so envelope wrapping can make invalid JSON look like normal collected evidence. Reject those constants before wrapping, and serialize new envelopes with allow_nan=False so metadata or numeric overflow cannot introduce non-finite output.

Preserve the original file and log the failure through the existing per-file skip behavior. Valid payloads and YAML date metadata retain their existing behavior. Includes regression coverage, a changelog entry and operator troubleshooting guidance.

Adapted from JSON qualification hardening by Cody Mitchell (@cmitchell-du) at Defense Unicorns. This contribution reuses the native envelope path. Timestamp ordering needs a separate shared contract and is proposed in #259.

Validation:

  • Before the fix: 10 negative cases failed against unchanged upstream; 16 cases passed.
  • After the fix: all 26 envelope cases pass.
  • ruff check framework/: pass.
  • mypy framework/: pass, 47 source files.
  • Full local pytest: 6223 passed, 3 failed, 59 skipped, 11 subtests passed. All three failures also reproduce on unchanged base 5dac90a in the same environment: the CertificateClient SDK test lacks azure.keyvault.certificates, and two CLI color tests fail their ANSI assertions. This is not a claim that the full suite is green.

Scope: envelope wrapping only. This does not replace consumer qualification or add a universal timestamp/freshness rule, and it does not harden every separate uploader or legacy-artifact read path. Originals remain preserved rather than silently repaired.

togofishicorn and others added 3 commits November 3, 2026 09:13
Resolve the CHANGELOG conflict by keeping both sides' Fixed entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@bruceweygandt bruceweygandt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for this fix. I merged main into the branch to resolve the CHANGELOG conflict and kept both entries. The envelope tests (26), ruff and mypy on framework/, and the full suite all pass on the merge, and CI is green. Approved.

@bruceweygandt
bruceweygandt merged commit 5d6db5c into paramify:main Nov 10, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants