Skip to content

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

Description

@altrudev

Problem

verify_assertion() compares the peer-supplied assertion version with:

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

where ASSERTION_VERSION = 1.

In Python, True == 1, so a JSON assertion carrying:

{"version": true}

is accepted as version 1 instead of being refused as an invalid version primitive.

The companion content-marking specification defines the assertion with "version": 1 and says an unknown version is rejected rather than parsed best-effort. The current verifier therefore admits a boolean value as the known version because of host-language equality semantics.

Reproduction

Starting from a valid assertion produced by build_assertion(), replace only:

assertion["data"]["version"] = True

verify_assertion(assertion, record_bytes) succeeds on current main.

The existing version regression covers version = 2, but not the Python bool/int boundary.

Proposed change

Establish the version primitive before accepting version 1, explicitly excluding bool.

A minimal regression set should hold:

  • 1 -> accepted;
  • true -> refused;
  • false -> refused;
  • "1" -> refused;
  • null -> refused;
  • another integer such as 2 -> refused.

This issue deliberately does not make a claim about floating-point JSON numbers; the defect is the unambiguous Python bool/int equivalence.

Scope

Consumer-side validation only. No wire-format, schema, cryptographic, downgrade, or C2PA change is proposed.

AI-assistance disclosure: ChatGPT assisted with source triage, adversarial-case design, and drafting. altrudev reviewed the bounded claim and remains responsible for the contribution.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-review:HIGHContributor check flagged HIGH risk

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions