ci: harden workflows for OpenSSF Scorecard (v0.5.2) - #5
Merged
Conversation
- Pin every third-party Action to a 40-char commit SHA with `# vX.Y.Z` comments across ci, codeql, release, and scorecard workflows (Pinned-Dependencies) - Move `contents: write` and `id-token: write` from the workflow level to the publish job in release.yml; default top-level permission is now `contents: read` (Token-Permissions) - Add `persist-credentials: false` to every actions/checkout step so the auth token is not left in `.git/config` - Add SECURITY.md with private advisory + email reporting channels, supported-versions matrix, response SLA, and out-of-scope notes (Security-Policy) - Add explicit job-level `contents: read` to the CI test job
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Branch protection requires "Scorecard analysis" but the workflow only ran on push to main, so it was forever "expected" on PRs. - Add `pull_request` trigger. - Skip `publish_results` on PRs so the public OpenSSF database keeps reflecting main-branch state. - Skip the code-scanning SARIF upload on PRs (security-events: write isn't available on fork PRs and the alert UI tracks main).
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
Bumps the OpenSSF Scorecard score by addressing the three high-impact, code-fixable checks that were dragging it down (Pinned-Dependencies 3 → 10, Token-Permissions 0 → 10, Security-Policy 0 → 10).
ci.yml,codeql.yml,release.yml, andscorecard.ymlis now pinned to a 40-char commit SHA with a trailing# vX.Y.Zcomment. Dependabot'sgithub-actionsecosystem will keep these in sync.release.ymlno longer holdscontents: write/id-token: writeat the workflow level. Both moved to thepublishjob only. Top-level default is nowcontents: read. Everyactions/checkoutstep also addspersist-credentials: falseso the auth token isn't left in.git/config. CI test job gets an explicit job-levelcontents: read.SECURITY.mdat repo root with private advisory + email channels, supported-versions matrix, response SLA, and out-of-scope notes.SECURITY.md. CHANGELOG marks this as0.5.2.package.jsonbumped to0.5.2.After this lands, branch protection is enabled, and a
v0.5.2tag is cut, the score should jump from 6.0 to roughly 8.5–9.0. Code-Review and Contributors are the remaining drags (solo-project limitations).Test plan
npm run build— clean tsup output, ESM 16.04 KB / CJS 17.18 KB /.d.ts7.99 KBnpm test— 188/188 passing, 7/7 suitesnpm run lint— clean,--max-warnings=0npm run type-check— cleannpm run check-types-pack— 4/4 attw quadrants 🟢Analyze (javascript-typescript)is green