fix(content-marking): reject boolean assertion version - #282
Open
altrudev wants to merge 2 commits into
Open
Conversation
Contributor
|
🔴 Contributor Check: HIGH
Automated check by AgenTrust Contributor Check. |
lywinged
approved these changes
Sep 4, 2026
lywinged
left a comment
Collaborator
There was a problem hiding this comment.
Approved on 37b8e2b over fc38496. Reproduced on main: an assertion from build_assertion() with data.version set to true passes verify_assertion(). On this head it is refused and integer 1 still passes; the PR's own test file has 2 of 7 cases failing against main and none here. Suite 1,174 passed, 1 skipped; ruff, mypy and the dash check clean. One thing outside the claim, for a follow-up rather than this PR: 1.0 passes on main and on this head, since 1.0 == 1 too, and a serializer that writes JSON numbers as floats will produce it.
Tool-assisted: the runs and this write-up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #281.
What
content_marking.verify_assertion()compared the peer-supplied assertion version directly with integer1:Because Python treats
True == 1, a JSON assertion carrying"version": truewas accepted as version 1.This change establishes the boolean boundary explicitly before the existing version comparison:
The change is deliberately narrower than a general JSON-number rule. It does not make a claim about floating-point representations; it closes the unambiguous Python
bool/intalias.Regression coverage
Focused coverage holds:
1-> unchanged success;true-> refusal;false-> refusal;"1"-> refusal;null-> refusal;2-> refusal.A dedicated regression names the mutation property: restoring the old plain
!= 1comparison makes booleantruealias the supported version again.Verification
The exact branch source and regression file were re-read after the writes. The predicate matrix was independently exercised for
1,true,false,"1",null, and2; only integer1is accepted by the new condition, while the previous condition accepts both1andtrue.A repository-wide pytest/ruff/mypy run is not claimed here because the available execution environment for this contribution does not currently have the TRACE checkout/toolchain. No GitHub Actions run is claimed.
Scope
Consumer-side primitive validation only. No wire-format, schema, cryptographic, downgrade, or C2PA behavior change.
AI-assistance disclosure: ChatGPT assisted with source triage, adversarial-case design, implementation drafting, and diff review.
altrudevreviewed the bounded claim and remains responsible for the contribution.