Skip to content

ci: harden workflows for OpenSSF Scorecard (v0.5.2) - #5

Merged
Sajadlance merged 2 commits into
mainfrom
security/scorecard-hardening
May 5, 2026
Merged

ci: harden workflows for OpenSSF Scorecard (v0.5.2)#5
Sajadlance merged 2 commits into
mainfrom
security/scorecard-hardening

Conversation

@Sajadlance

Copy link
Copy Markdown
Collaborator

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).

  • Pinned-Dependencies: every third-party Action across ci.yml, codeql.yml, release.yml, and scorecard.yml is now pinned to a 40-char commit SHA with a trailing # vX.Y.Z comment. Dependabot's github-actions ecosystem will keep these in sync.
  • Token-Permissions: release.yml no longer holds contents: write / id-token: write at the workflow level. Both moved to the publish job only. Top-level default is now contents: read. Every actions/checkout step also adds persist-credentials: false so the auth token isn't left in .git/config. CI test job gets an explicit job-level contents: read.
  • Security-Policy: new SECURITY.md at repo root with private advisory + email channels, supported-versions matrix, response SLA, and out-of-scope notes.
  • README gets a Security section linking to SECURITY.md. CHANGELOG marks this as 0.5.2. package.json bumped to 0.5.2.

After this lands, branch protection is enabled, and a v0.5.2 tag 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.ts 7.99 KB
  • npm test — 188/188 passing, 7/7 suites
  • npm run lint — clean, --max-warnings=0
  • npm run type-check — clean
  • npm run check-types-pack — 4/4 attw quadrants 🟢
  • CI matrix on Node 18.x / 20.x / 22.x / 24.x is green
  • CodeQL Analyze (javascript-typescript) is green
  • Scorecard re-runs and reports the new score

- 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

codecov Bot commented May 5, 2026

Copy link
Copy Markdown

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).
@Sajadlance
Sajadlance merged commit 0daa661 into main May 5, 2026
8 checks passed
@Sajadlance
Sajadlance deleted the security/scorecard-hardening branch May 5, 2026 17:46
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