Skip to content

fix(content-marking): reject boolean assertion version - #282

Open
altrudev wants to merge 2 commits into
agentrust-io:mainfrom
altrudev:fix/content-marking-version-bool-281
Open

fix(content-marking): reject boolean assertion version#282
altrudev wants to merge 2 commits into
agentrust-io:mainfrom
altrudev:fix/content-marking-version-bool-281

Conversation

@altrudev

@altrudev altrudev commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Closes #281.

What

content_marking.verify_assertion() compared the peer-supplied assertion version directly with integer 1:

if data.get("version") != ASSERTION_VERSION:

Because Python treats True == 1, a JSON assertion carrying "version": true was accepted as version 1.

This change establishes the boolean boundary explicitly before the existing version comparison:

version = data.get("version")
if isinstance(version, bool) or version != ASSERTION_VERSION:

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/int alias.

Regression coverage

Focused coverage holds:

  • integer 1 -> unchanged success;
  • boolean true -> refusal;
  • boolean false -> refusal;
  • string "1" -> refusal;
  • null -> refusal;
  • integer 2 -> refusal.

A dedicated regression names the mutation property: restoring the old plain != 1 comparison makes boolean true alias 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, and 2; only integer 1 is accepted by the new condition, while the previous condition accepts both 1 and true.

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. altrudev reviewed the bounded claim and remains responsible for the contribution.

@altrudev
altrudev requested a review from a team as a code owner September 4, 2026 13:20
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🔴 Contributor Check: HIGH

Check Result
Profile HIGH
Credential LOW
Overall HIGH

Automated check by AgenTrust Contributor Check.

@github-actions github-actions Bot added the needs-review:HIGH Contributor check flagged HIGH risk label Sep 4, 2026

@lywinged lywinged left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review:HIGH Contributor check flagged HIGH risk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

content-marking: boolean true is accepted as assertion version 1

2 participants