[TECHNICAL] SBOM changes to be pushed in an specific branch with signed commits#4837
[TECHNICAL] SBOM changes to be pushed in an specific branch with signed commits#4837
Conversation
a00da5b to
be8c3e2
Compare
|
Moving to "In progress" again to inspect an issue before reviewing @joragua @DeepDiver1975 |
4d0dcb2 to
531a27d
Compare
|
Ready for review again! |
531a27d to
c5a3d1b
Compare
DeepDiver1975
left a comment
There was a problem hiding this comment.
PR Review: SBOM Workflow — Signed Commits to Dedicated Branch
Overview
This PR restructures the SBOM generation CI workflow to address security policy requirements. Key changes:
- Workflow now triggers only on
masterpushes (previously: all feature/fix/etc. branches) - Replaced direct commit push with
peter-evans/create-pull-requestto maintain achore/sbom-updatebranch - Added
sign-commits: truefor verified commits - Improved output variable naming (
changes=true/falsevs invertedno_changes) - Added manual dispatch with configurable
target_branch - Added release template step to merge the SBOM branch before cutting a release
Code Quality & Style
Improvements:
- Cleaner boolean semantics:
changes=true/falseis much more readable than the oldno_changes=true/false - Conditional token generation (
if: steps.compare.outputs.changes == 'true') avoids unnecessary API calls — good practice - All action pins use commit SHAs — secure
- Comparison logic is well-documented with inline comments
Issues:
-
Missing error fallback in
git show— This is a regression. The old code had|| echo '{}' > sbom_prev.json; the new code does not:git show "$PREVIOUS_SBOM_REF:sbom.json" > sbom_prev.jsonIf
sbom.jsondoesn't exist onorigin/master(e.g., first run, or on a freshly dispatched non-mastertarget_branch), the workflow will fail hard instead of gracefully treating it as an empty/new SBOM. -
fetch-depth: 2is now vestigial — This was needed for the oldHEAD~1comparison. Now that comparison is done against remote branches, depth 2 provides no benefit. Minor cleanup opportunity. -
Hardcoded
FALLBACK_BRANCH="master"— When dispatching manually with a customtarget_branch, the fallback for comparison is stillmaster, not the target branch. This may be intentional (always compare against master as the source of truth), but deserves a comment explaining the reasoning.
Logic & Correctness
-
No concurrency policy + push to master — The PR description says "Removed concurrency policy. Every PR must trigger the workflow." But with the trigger now being
push: branches: [master], rapid consecutive merges to master could create race conditions where two workflow runs both try to create/updatechore/sbom-update. Thepeter-evans/create-pull-requestaction handles the "update existing PR" case, but concurrent git operations on the same branch without a concurrency guard can still cause conflicts. Consider re-adding a concurrency group scoped to the source branch:concurrency: group: sbom-update cancel-in-progress: false
-
Infinite loop potential — low risk but worth documenting — When
chore/sbom-updateis merged into master, the workflow triggers again. Becausedelete-branch: trueremoves the branch on merge, the fallback toorigin/masterwill be used, and the generated SBOM should match master's SBOM exactly →changes=false→ workflow stops cleanly. This is correct behavior, but it's non-obvious and worth a brief comment in the workflow.
Security
-
sign-commits: truerequires App configuration — This is the core security improvement, butsign-commits: trueinpeter-evans/create-pull-requestrequires the GitHub App to have commit signing configured at the organization level. IfSBOM_APP_ID/SBOM_APP_PRIVATE_KEYdon't have the required permissions, this will fail silently or with a cryptic error. Confirm the App has been granted signing capabilities. -
permissions: contents: write— Broad but carried over from the previous version; no regression.
Minor
-
Typo in changelog entry (
changelog/unreleased/4837):"pushing them to an specific branch"
Should be "a specific branch."
Summary
| Area | Status |
|---|---|
| Core logic | Correct |
| Security improvement | Solid — signed commits via App token is the right approach |
| Regression risk | git show lacks the old || echo '{}' fallback |
| Race condition | Possible without concurrency guard |
| Cleanup | fetch-depth: 2 vestigial |
The overall approach is sound and the goal (signed, auditable SBOM commits) is well-implemented. The main items to address before merging are the missing git show error fallback and clarifying the concurrency strategy.
c5a3d1b to
2a28721
Compare
I think it can be safety assumed that
right, removed.
comment added
SBOM updates will never change SBOM content. no action required, IMO
permissions are granted from the proper github app. Nothing to do here.
👍
Fixed |
2a28721 to
4e63507
Compare
New logic of the workflow:
master, the workflow is triggeredHEADofmasterchore/sbom-updatebranch, if the branch exists. If not, get theorigin/masterone. The idea is getting the newest version to compare withjq, in order to know if there are changes or not.chore/sbom-updatemasteras defaultRelated Issues
App:
ReleaseNotesViewModel.ktcreating a newReleaseNote()with String resources (if required)QA