Skip to content

provenance: identity locator fields accept truthy non-string values #285

Description

@altrudev

spec/server-provenance-v1.md defines the two identity locators as textual identifiers:

  • identity.artifact.package is a Package URL;
  • identity.endpoint.url is a URL.

The shared producer/consumer structural check currently tests both fields by truthiness only:

if not artifact.get("package"):
    ...

if not endpoint.get("url"):
    ...

As a result, truthy non-string JSON values such as true, 1, [1], or {"x": 1} satisfy the locator-presence check. A signed peer provenance record can therefore verify with a non-text artifact.package or endpoint.url as long as the sibling digest is valid.

This is narrower than Package URL / URI syntax validation. The immediate boundary is only the JSON primitive type the specification names: both locator fields should be non-empty strings rather than arbitrary truthy values.

Reproduction

Against current main at fc38496f3ddacaa7ce922e1218b6fcd91735d751, the exact predicates above accept each of:

true
1
[1]
{"x": 1}

Existing coverage checks a missing endpoint key digest but does not exercise non-string locator values.

Proposed bounded fix

Use one small non-empty-string boundary for artifact.package and endpoint.url in _check_structure(), exercised through both build_record() and verify_record().

Do not expand this change into full Package URL or URL syntax policy; that can be decided separately if desired.

AI-assistance disclosure: ChatGPT assisted with source triage, adversarial-case design, duplicate search, and issue 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