Skip to content

chore(hooks): make SBOM check advisory, fix pre-commit exec bit#126

Merged
dc0sk merged 1 commit into
mainfrom
chore/fix-sbom-prepush-hook
Jul 4, 2026
Merged

chore(hooks): make SBOM check advisory, fix pre-commit exec bit#126
dc0sk merged 1 commit into
mainfrom
chore/fix-sbom-prepush-hook

Conversation

@dc0sk

@dc0sk dc0sk commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Problem

The pre-push hook hard-failed whenever the regenerated SPDX SBOM differed from the committed one. But cargo sbom enumerates a different per-target dependency set across tool versions (0.10.0 lists 217 packages vs the committed 95), so the check failed spuriously for anyone whose cargo-sbom differs from whoever last committed the SBOM. The SBOM is not checked in CI or at release (grep -r sbom .github/workflows → nothing), so this gated pushes for no benefit — forcing --no-verify.

Separately, .githooks/pre-commit was committed non-executable (0644), so git silently skipped it and its fmt/clippy/test checks never ran.

Fix

  • pre-push: SBOM drift is now an advisory warning (and restores the working tree) rather than a hard failure; fmt/check/test remain hard gates.
  • generate-sbom.sh: pin the recommended cargo-sbom version (0.10.0) and warn on mismatch, so a genuine SBOM refresh is reproducible.
  • pre-commit: marked executable (0644 → 0755) so it actually runs.

The SBOM artifact content is intentionally left unchanged (95→217 would be a compliance-scope policy change for the maintainer to make deliberately).

Test plan

  • Pushed this branch without --no-verify: pre-commit ran (365 tests), pre-push ran fmt/check/test and printed the SBOM warning without blocking. ✅

🤖 Generated with Claude Code

https://claude.ai/code/session_01Jf8uBU8AYxkrG8fa8yo6tC

The pre-push hook hard-failed when the regenerated SPDX SBOM differed from
the committed one, but `cargo sbom` enumerates different per-target
dependency sets across tool versions (e.g. 0.10.0 lists 217 packages vs the
committed 95), so the check failed spuriously for anyone whose cargo-sbom
differed from whoever last committed it. The SBOM is not checked in CI or at
release, so this gated pushes for no benefit.

- pre-push: SBOM drift is now a warning (and restores the working tree)
  rather than a hard failure; fmt/check/test remain hard gates
- generate-sbom.sh: pin the recommended cargo-sbom version (0.10.0) and warn
  on mismatch, so a real SBOM refresh is reproducible
- pre-commit: mark executable (0644 -> 0755) so it actually runs; it was
  being silently skipped by git

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dc0sk
dc0sk merged commit e12a73a into main Jul 4, 2026
10 checks passed
@dc0sk
dc0sk deleted the chore/fix-sbom-prepush-hook branch July 4, 2026 06:26
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