chore(security): harden release workflow and add dependabot#630
Open
bardhlohaj wants to merge 4 commits into
Open
chore(security): harden release workflow and add dependabot#630bardhlohaj wants to merge 4 commits into
bardhlohaj wants to merge 4 commits into
Conversation
Scorecard flagged every uses: line in release.yml for floating major-tag references (@v4, @v5, @V3) which are mutable by the action owner. Pinning each to the latest SHA within the currently-declared major version makes the supply chain auditable without changing behavior. Companion workflow helper (which produces the same transformation): https://app.stepsecurity.io/secureworkflow/yomotsu/camera-controls/release.yml/dev?enable=pin Made-with: Cursor
Adds a top-level permissions: contents: read default, plus a release-job override granting contents:write, issues:write, pull-requests:write -- the minimum set required by @semantic-release/github. deploy-job permissions are unchanged. Scorecard Token-Permissions check goes from 0 to 10. Made-with: Cursor
Weekly grouped updates for GitHub Actions so the pinned SHAs do not drift when actions ship patches or security fixes. Made-with: Cursor
Minimal security policy declaring supported versions and pointing to GitHub private vulnerability reporting. Satisfies Scorecard Security-Policy check. Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR is a small, security-only hardening pass on the
release.ymlworkflow, plus a Dependabot config so the pins do not go stale, plus a minimalSECURITY.md. No behavioral or version changes to the release pipeline; everything keeps working exactly as today.Motivation is the OpenSSF Scorecard report for this repo, which currently scores 2.9/10. Scorecard is used by downstream consumers to assess dependency supply-chain risk, and a few of its checks can be satisfied with very small edits here.
Changes
1. Pin GitHub-owned actions by commit SHA
Scorecard's
Pinned-Dependenciescheck currently flags everyuses:line in.github/workflows/release.ymlbecause they reference floating major tags (@v4,@v5,@v3) which can be force-repointed by the action owner without any change visible here. This is the standard supply-chain concern that led to, e.g., thetj-actions/changed-filesincident.I pinned each action to the latest SHA within the currently-declared major version, so behavior is identical to what the workflow does today, with a trailing version comment for readability:
actions/checkout@v4@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1actions/setup-node@v4@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0actions/upload-artifact@v4@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2actions/download-artifact@v4@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0actions/configure-pages@v5@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0actions/upload-pages-artifact@v3@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1actions/deploy-pages@v4@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5This is the same transformation the StepSecurity secure-workflow helper produces.
2. Restrict
GITHUB_TOKENpermissions (principle of least privilege)Scorecard's
Token-Permissionscheck currently flags the workflow because there is no top-levelpermissions:block, so every job inherits the repository's default token scopes (often broad write).I added:
permissions: contents: read(read-only fallback for any step that doesn't opt into more).release-joboverride:contents: write,issues: write,pull-requests: write— the minimum set required bysemantic-release's default plugins.@semantic-release/githubneedscontents: writeto create the GitHub release and push tags, and it needsissues: writepluspull-requests: writeto post release-note comments on the issues/PRs referenced in the commit range.deploy-job: unchanged (contents: read,pages: write,id-token: writeare already declared at job level, which is correct).3. Add Dependabot config for GitHub Actions
A new
.github/dependabot.ymlwith a weekly schedule for thegithub-actionsecosystem ensures pinned SHAs get bumped automatically when actions ship security fixes or new patches, rather than drifting silently. Without this, SHA-pinning turns into a maintenance burden.If Dependabot is disabled at the org/repo level the file is a no-op and has no effect on anything; it just sits there.
4. Add
SECURITY.mdA minimal security policy declaring the supported version line and the reporting channel (GitHub private vulnerability reporting). This satisfies Scorecard's
Security-Policycheck and gives downstream security teams a documented place to send reports.Scorecard effect (projection)
Overall score projection: ~2.9 -> ~5.5-6.0.
A companion issue will be filed for the only remaining Scorecard check that can't be addressed via a PR — branch protection — since that is a repository settings change only a maintainer can make.
Commits
Four atomic commits so each change is independently reviewable. Happy to squash on merge if preferred.
chore(security): pin GitHub Actions by SHA in release.ymlchore(security): restrict GITHUB_TOKEN permissions to least privilegechore: add Dependabot config for github-actions ecosystemdocs: add SECURITY.mdTesting
main, so no CI runs on thisdev-targeted PR; the workflow diff can be verified by readingrelease.ymldirectly.semantic-releasepermissions are set per the official@semantic-release/githubdocs.References
devandmainto satisfy OpenSSF Scorecard #631 (branch protection, maintainer-only)Made with Cursor