Skip to content

Statement rejects the in-toto framework's git digest types (gitCommit/gitTree); would you take an opt-in? #1899

Description

@DrVelvetFog

Statement validates subjects against Digest = Literal["sha256", "sha384", "sha512", "sha3_256", "sha3_384", "sha3_512"] (sigstore/dsse/__init__.py), so a statement whose subject uses the git digest types the in-toto framework defines — gitCommit, gitTree, gitTag — is rejected as malformed. The unknown key itself is the rejection, so adding a sha256 alongside doesn't help.

Repro on 4.5.0:

import json
from sigstore.dsse import Statement

stmt = {
    "_type": "https://in-toto.io/Statement/v1",
    "subject": [{"name": "example", "digest": {"gitTree": "4b825dc642cb6eb9a060e54bf8d69288fbee4904"}}],
    "predicateType": "https://example.com/predicate/v1",
    "predicate": {},
}
Statement(json.dumps(stmt).encode())   # sigstore.errors.Error: malformed in-toto statement

The same statement with {"sha256": ...} is accepted; with both keys it's rejected again.

I know the restriction is deliberate — #1018 keeps the default set aligned with Sigstore's algorithm registry, and git digests are SHA-1-shaped, which is exactly what it excludes. I'm not asking to widen the default. But statements about git objects are a real category (the framework defines the types, and SLSA's source track lives on them), and right now the only way to sign one with this library is to give up the DSSE envelope and sign the statement bytes as an artifact — which keeps key custody and identity binding but loses the typing for everyone downstream.

Would you take an opt-in that leaves the default untouched? Something like Statement(..., allow_unregistered_digests=True), or a laxer parse mode on the verify side. If some shape here sounds acceptable I'm happy to write the PR.

(Related: once #1846 ships, the rejection at least names the offending field; this issue is about accepting it.)

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions