Skip to content

Emit unsigned normalization attestations with --attest - #41

Merged
tonit merged 1 commit into
mainfrom
13-normalize-attest
Sep 7, 2026
Merged

tonit merged 1 commit into
mainfrom
13-normalize-attest

Conversation

@tonit

@tonit tonit commented Sep 6, 2026

Copy link
Copy Markdown
Member

rio normalize --attest now writes one unsigned in-toto Statement v1 per normalized SBOM. Each statement binds the output digest to the complete artifact record plus the tool and manifest identity, so consumers can sign the normalization claim in the follow-up tooling.

Statements use <artifact-id>.intoto.json and the versioned https://rebaze.com/attestation/sbom-normalization/v1 predicate. They preserve every index artifact field, including optional integrity findings, and are written atomically before index.json. Gate failures still produce statements under both gate modes. Existing SBOM and index bytes are unchanged.

The README documents the predicate and local-path semantics. Statements remain unsigned; signing and verification tooling is tracked in #14.

Validation:

  • go test -race ./..., including the no-network import check
  • go vet ./..., go mod tidy -diff, formatting and diff checks
  • CGO_ENABLED=0 go build -trimpath -o rio ./cmd/rio and CLI help smoke checks
  • Tests cover digest agreement with files on disk, lossless per-artifact records, deterministic output, opt-in behavior, failed gates, input errors, and failed statement writes
  • Independent agent review

Fixes #13

@tonit
tonit marked this pull request as ready for review September 7, 2026 06:27
Copilot AI lite review requested due to automatic review settings September 7, 2026 06:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The implementation matches the stated contract (determinism, opt-in behavior, write ordering, and gate semantics) and is backed by targeted unit and CLI tests.

Pull request overview

This pull request adds optional in-toto Statement v1 emission to rio normalize so each normalized SBOM can be accompanied by an unsigned, deterministic attestation that binds the output digest to the complete per-artifact index record plus tool and manifest identity. This fits rio’s model of producing offline, self-contained run artifacts (SBOMs + index.json) that downstream tooling can later sign/verify.

Changes:

  • Adds --attest to rio normalize to write <artifact-id>.intoto.json statements (unsigned) before index.json.
  • Introduces internal/index.MarshalStatements to generate deterministic, pretty-printed Statement v1 JSON using the normalized index representation.
  • Documents the predicate contract and local-path semantics in README.md, and notes the planned signing tooling in tools/README.md.
File summaries
File Description
tools/README.md Adds documentation pointing to the new attestation contract and clarifies that signing/verification is planned (issue #14).
README.md Documents --attest, the Statement v1 contract, predicate type, determinism guarantees, and path semantics.
internal/index/attestation.go Implements Statement v1 marshaling per artifact, reusing index normalization to preserve shape and determinism.
internal/index/attestation_test.go Adds unit tests ensuring lossless artifact/tool/manifest round-tripping, normalization behavior, and invalid-index rejection without partial output.
internal/cli/normalize.go Wires --attest into normalize flow; writes statements after SBOMs and before index.json, preserving existing bytes when flag is absent.
internal/cli/attest_test.go Adds end-to-end CLI tests for opt-in behavior, determinism, digest agreement with on-disk files, gate-mode behavior, and write-failure handling.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@tonit
tonit merged commit aedd9f7 into main Sep 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

normalize: emit an in-toto attestation of the run with --attest

2 participants