Skip to content

fix: sign the manifest digest, not the first sha256 token; add --tlog-upload - #36

Merged
ValgulNecron merged 1 commit into
mainfrom
fix/digest-parse-and-tlog
Jul 24, 2026
Merged

ValgulNecron merged 1 commit into
mainfrom
fix/digest-parse-and-tlog

Conversation

@ValgulNecron

Copy link
Copy Markdown
Collaborator

The bug

build.sh --sign chose the digest to sign with:

digest="$(printf '%s\n' "$out" | grep -oE 'sha256:[0-9a-f]{64}' | head -n1)"

That is the first sha256 token anywhere in combined oras push output — not necessarily the pushed manifest digest. If a layer digest is printed in full, the bundle signature covers the wrong object.

Current oras abbreviates layer digests to 12 chars, so today only one full token appears and the bug is latent — but that's output formatting, not a contract. A verbose flag or a version change flips it to active, silently, in the release pipeline.

The fix

Parse the authoritative Digest: sha256:<64hex> summary line (via a parse_manifest_digest() helper) and fail loudly if it's absent.

Tests — test-build-sh.sh (new)

--sign only ever executes in the release/republish workflows, so this code path had no test coverage at all. Added a suite that needs no registry and no cosign:

  • The regression, using a synthetic full-layer-digest fixture — real oras output can't reproduce the bug today, so this is the only way to pin the behavior.
  • Malformed input (short hash, non-anchored mention, no digest) must yield empty rather than sign junk.
  • Whitespace tolerance; --tlog-upload without --sign exits 2.

Verified the suite fails against the old parser (returns the layer digest sha256:4b2b418b… instead of the manifest digest) and passes against the new one — so it's a real regression test, not a vacuous one. Wired into validate.yml.

--tlog-upload (new flag)

Opt in to recording signatures in the public Rekor transparency log for official bundles. The default stays offline (--tlog-upload=false), so local/air-gapped authoring and the plain-HTTP e2e keep working without Sigstore connectivity.

Signing is also pinned to cosign's classic format (--new-bundle-format=false --use-signing-config=false) — the format the operator's cosign/v2 verifier reads, and because cosign's newer Rekor v2 flow requires a TSA that keyed signing can't satisfy.

Part of the Gameplane signing-transparency rollout (Gameplane#184 merged, #185 open).

🤖 Generated with Claude Code

…-upload

build.sh --sign picked the digest to sign with
`grep -oE 'sha256:[0-9a-f]{64}' | head -n1` over combined `oras push`
output. That is the first sha256 token ANYWHERE in the output, which is
not necessarily the pushed manifest digest — a layer digest printed in
full would be signed instead, producing a signature over the wrong
object. Current oras abbreviates layer digests to 12 chars, so the bug is
latent rather than active, but that is output formatting, not a contract.

- Parse the authoritative "Digest: sha256:<64hex>" summary line instead,
  via a parse_manifest_digest() helper.
- Add test-build-sh.sh (no registry, no cosign needed) covering the
  regression with a synthetic full-layer-digest fixture — real oras
  output cannot reproduce the bug today — plus malformed-input and flag
  guards. Verified to FAIL against the old parser (it returns the layer
  digest) and pass against the new one. Wired into validate.yml, since
  the --sign path otherwise only ever runs in the release workflows.
- Add --tlog-upload: opt in to recording signatures in the public Rekor
  transparency log for official bundles. Default stays offline
  (--tlog-upload=false) so local/air-gapped authoring and the plain-HTTP
  e2e keep working without Sigstore connectivity.
- Pin signing to cosign's classic format (--new-bundle-format=false
  --use-signing-config=false): the format the operator's cosign/v2
  verifier reads, and the newer Rekor v2 flow needs a TSA that keyed
  signing cannot satisfy.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: valgulnecron <39313199+ValgulNecron@users.noreply.github.com>
@ValgulNecron
ValgulNecron merged commit 91c75ed into main Jul 24, 2026
1 check passed
@ValgulNecron
ValgulNecron deleted the fix/digest-parse-and-tlog branch July 24, 2026 17:40
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.

1 participant