Skip to content

fix(ci): trim SBOM to fit under 16MB attestation limit#809

Merged
KrisF-Midnight merged 18 commits into
mainfrom
SRE-1910/github-native-attestations
Feb 27, 2026
Merged

fix(ci): trim SBOM to fit under 16MB attestation limit#809
KrisF-Midnight merged 18 commits into
mainfrom
SRE-1910/github-native-attestations

Conversation

@KrisF-Midnight

@KrisF-Midnight KrisF-Midnight commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

Overview

The midnight-node image produces a ~19MB SBOM (1,990 packages), exceeding the hard-coded 16MB limit in actions/attest-sbom. This causes SBOM attestation to fail with predicate file exceeds maximum allowed size: 16777216 bytes.

Fix: trim the SBOM before attesting, keep the full version as artifact.

Two optimizations applied to generate_sbom_with_retry and a new trim_sbom_for_attestation function:

  1. Exclude Syft file cataloger (--select-catalogers '-file') — removes per-file entries, reduces SBOM from ~22MB to ~19MB
  2. Strip SPDX relationships + minify JSON (jq -c 'del(.relationships)') — removes inter-package dependency edges and whitespace, reduces from ~19MB to ~12.3MB (4.5MB headroom)

The full unmodified SBOM is still uploaded as a build artifact for detailed analysis. The attested SBOM retains all 1,990 packages with names, versions, licenses, checksums, and SPDX IDs.

🗹 TODO before merging

  • Ready

📌 Submission Checklist

  • Changes are backward-compatible (or flagged if breaking)
  • Pull request description explains why the change is needed
  • Self-reviewed the diff
  • I have included a change file, or skipped for this reason: CI-only change
  • If the changes introduce a new feature, I have bumped the node minor version
  • Update documentation (if relevant)
  • Updated AGENTS.md if build commands, architecture, or workflows changed
  • No new todos introduced

🧪 Testing Evidence

Please describe any additional testing aside from CI:

  • Additional tests are provided (if possible)

🔱 Fork Strategy

  • Node Runtime Update
  • Node Client Update
  • Other:
  • N/A

Links

Krisztian Feher and others added 17 commits February 25, 2026 10:54
… attestations

Replace Cosign keyless signing with GitHub's actions/attest-build-provenance
and actions/attest-sbom actions, eliminating external Sigstore/Rekor dependencies.
Re-enable SBOM attestation (previously disabled due to Rekor rejecting payloads).
Add build provenance attestation for release binary assets.

- Replace cosign sign with actions/attest-build-provenance for all images
- Replace cosign attest with actions/attest-sbom for SBOM attestation
- Add binary release asset attestation (tar.gz and SHA256SUMS)
- Delete sign-image.sh, sign-binary.sh, sign-image.yml
- Remove attest_sbom_with_retry and attest_sbom_to_multiarch from sbom-scan.sh
- Rewrite verify-image.sh to use gh attestation verify
- Support both GHCR orgs (midnight-ntwrk and midnightntwrk)

JIRA: SRE-1910
The --format '{{.Manifest.Digest}}' template only works for manifest
lists, not single-arch v2 manifests. Replace with --raw | sha256sum
which computes the correct content-addressable digest for any manifest
type.
Replace cosign verify-blob with gh attestation verify. Add test job
to test-attestation.yml to validate the script against an attested
test binary.
…testations

Replace all cosign/Sigstore references with GitHub native attestation
commands (gh attestation verify). Remove .sig/.pem file references,
Rekor/Fulcio architecture descriptions, and Sigstore outage procedures.
Remove test-attestation.yml (validated, no longer needed).
Resolves GHSA-mw96-cpmx-2vgc (arbitrary file write via path traversal
in rollup 4.0.0-4.58.0).
Syft v1.20.0+ enables a file cataloger by default that lists every file
in the container, bloating the SBOM from ~1.4MB to ~24MB. This exceeds
the 16MB hard limit in actions/attest-sbom, causing "predicate file
exceeds maximum allowed size" errors.

Adding --select-catalogers '-file' to exclude file metadata that isn't
needed for vulnerability scanning.

Includes a temporary test workflow to validate the fix against the same
midnight-node image that failed.
The midnight-node image produces a 19MB+ SBOM even without file
cataloger entries, exceeding the actions/attest-sbom 16MB hard limit.
Strip SPDX relationships before attesting while preserving the full
SBOM as a build artifact.
@KrisF-Midnight KrisF-Midnight requested a review from a team as a code owner February 27, 2026 10:42
…e-attestations

# Conflicts:
#	.github/workflows/sbom-scan-image.yml
@github-actions

Copy link
Copy Markdown
Contributor

kics-logo

KICS version: v2.1.16

Category Results
CRITICAL CRITICAL 0
HIGH HIGH 0
MEDIUM MEDIUM 99
LOW LOW 12
INFO INFO 83
TRACE TRACE 0
TOTAL TOTAL 194
Metric Values
Files scanned placeholder 30
Files parsed placeholder 30
Files failed to scan placeholder 0
Total executed queries placeholder 73
Queries failed to execute placeholder 0
Execution time placeholder 9

@KrisF-Midnight KrisF-Midnight changed the title feat(ci): migrate to GitHub native attestations fix(ci): trim SBOM to fit under 16MB attestation limit Feb 27, 2026
@KrisF-Midnight KrisF-Midnight self-assigned this Feb 27, 2026
@gilescope gilescope enabled auto-merge February 27, 2026 11:28
@KrisF-Midnight KrisF-Midnight merged commit 2ca01a0 into main Feb 27, 2026
35 of 38 checks passed
@KrisF-Midnight KrisF-Midnight deleted the SRE-1910/github-native-attestations branch February 27, 2026 11:31
m2ux added a commit that referenced this pull request Feb 27, 2026
Resolve merge conflict with #809 (trim SBOM for 16MB limit). Keep
Cosign-based attestation from this PR, add trim_sbom_for_attestation
step before cosign attest, and attest the trimmed SBOM. Full SBOM is
still uploaded as a build artifact.

Made-with: Cursor
m2ux added a commit that referenced this pull request Apr 23, 2026
Signed-off-by: Mike Clay <mike.clay@shielded.io>
m2ux added a commit that referenced this pull request Apr 23, 2026
Signed-off-by: Mike Clay <mike.clay@shielded.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants