Skip to content

OpenSecret: let Cosign verify a full-size EIF in the Dev release statement run - #1667

Merged
w3irdrobot merged 1 commit into
masterfrom
codex-cosign-eif-limit-maple
Nov 20, 2026
Merged

w3irdrobot merged 1 commit into
masterfrom
codex-cosign-eif-limit-maple

Conversation

@AnthonyRonning

@AnthonyRonning AnthonyRonning commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

The first real Dev run (44637021964, attempt 2) signed its statement with the Dev KMS key and then failed in the same step, while verifying what it had just signed:

Error: size of layer (234302194) exceeded the limit (134217728)
error: cosign verify-blob-attestation exited with 1

cosign verify-blob-attestation refuses to hash a blob over 128 MiB unless COSIGN_MAX_ATTACHMENT_SIZE raises the limit, and the Dev EIF is 234,302,194 bytes. attest-blob reads the file with no such check, so the signature and its transparency-log entry were made before the failure. Nothing was retained, published or pushed.

Change

  • cosign_verify sets COSIGN_MAX_ATTACHMENT_SIZE to MAX_EIF_BYTES (2 GiB), the bound prepare already enforces on the EIF. All three verifications (after signing, before upload, after read-back) go through this one call.
  • A test pins the variable on the verify call. The fake Cosign now records COSIGN_* variables as well.

Checked

  • Cosign v3.1.4 source: cmd/cosign/cli/verify/verify_blob_attestation.go:173 is the only size check on this command's blob path (the other callers are OCI paths). The limit is read from COSIGN_MAX_ATTACHMENT_SIZE with humanize.ParseBytes, which accepts a plain byte count.
  • Real Cosign 3.1.3 from this repository's pinned nixpkgs (the pinned 3.1.4 is Linux-only here), with the script's arguments, against a 234,302,194-byte file: it fails with the exact error above by default and gets past the size check with the variable set. It then stops at the signature check, with or without a blob: 3.1.3 assumes SHA-256 for every key, which 3.1.4 changed.
  • python3 -m unittest discover -s scripts/ci -p 'test_*.py' in the dev shell: 664 pass.

Not checked

  • A full verification with Cosign 3.1.4 of a real bundle over a file this large. That needs a signature in the public log, so the next Dev run is the first proof.
  • The steps after signing (artifact retention, the publisher credential, upload, read-back, the approval branch) have still never run for real.

Alternative

--digest and --digestAlg with the script's own SHA-256 would keep Cosign from reading the EIF at all. I kept the blob so Cosign still hashes the real file.

After this merges

Re-running the failed run would use the old script. Dispatch OpenSecret Dev release statement on master again with the same build run ID, 44636648269. It signs the same statement a second time, so the Dev key will have two log entries for it.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…ement run

The first real Dev run signed its statement with the KMS key and then
failed while verifying it: `cosign verify-blob-attestation` refuses to
hash a blob over 128 MiB by default, and the Dev EIF is 234,302,194
bytes. `attest-blob` has no such limit, so the signature and its log
entry were made before the failure.

The verify call now sets COSIGN_MAX_ATTACHMENT_SIZE to the 2 GiB bound
that prepare already enforces on the EIF. In Cosign v3.1.4 this is the
only size check on that command's blob path.

Co-Authored-By: Claude <[email protected]>

@w3irdrobot w3irdrobot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks right. I also ran the pinned Cosign v3.1.4 offline against a 234,302,194-byte file with the script's arguments: it fails with that exact size error by default and gets past the size check with COSIGN_MAX_ATTACHMENT_SIZE set. Our tests only ever used a small file, which is how this got through.

@w3irdrobot
w3irdrobot merged commit 52f4c37 into master Nov 20, 2026
21 checks passed
@w3irdrobot
w3irdrobot deleted the codex-cosign-eif-limit-maple branch November 20, 2026 14:41
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.

2 participants