Skip to content

ci: pin actions to commit SHAs, least-privilege permissions, cross-platform matrix - #7

Open
AjayBThorat-20 wants to merge 2 commits into
fix/node24-support-4.1.9from
ci/harden-workflows
Open

AjayBThorat-20 wants to merge 2 commits into
fix/node24-support-4.1.9from
ci/harden-workflows

Conversation

@AjayBThorat-20

@AjayBThorat-20 AjayBThorat-20 commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

What and why

Hardens the workflows, following OpenSSF Scorecard recommendations:

  • Every action is pinned to a full commit SHA (version noted in a comment), and checkouts use persist-credentials: false.
  • Workflow permissions default to contents: read; each job asks only for what it needs.
  • Tests run on ubuntu / macOS / Windows × Node 20 / 22 / 24. Windows is continue-on-error for now; fix/windows-support (fix: make fix and the unused-dependency fallback work on Windows #12) makes it pass, after which that flag can go.
  • release.yml publishes through npm trusted publishing (OIDC, with provenance) instead of a long-lived NPM_TOKEN, and creates the GitHub Release from the CHANGELOG.
  • create-test-projects.sh moves into test/ (and no longer deletes itself in its cleanup step).

Before the next release: trusted publishing has to be enabled on npmjs.com for this repo and release.yml (package settings → Trusted publishers). Until then the release job can't publish.

Stacked on #5.

Merging the stack: use Create a merge commit, not squash (squashing makes every later PR show these commits again). After merging the PR below this one, click Delete branch on it; GitHub then retargets this PR to main and CI runs.

How I tested it

🤖 Generated with Claude Code

…atform matrix

- Pin every action to a full commit SHA (with its version as a comment) and
  set persist-credentials: false on checkouts.
- Default workflow permissions to contents: read; jobs request only what they
  need.
- Test on ubuntu/macos/windows x Node 20/22/24. Windows is informational
  (continue-on-error) until npm spawning and the grep-based unused fallback
  work there.
- release.yml: publish via npm trusted publishing (OIDC, with provenance)
  instead of a long-lived NPM_TOKEN, and create the GitHub Release from the
  CHANGELOG automatically.
- Move create-test-projects.sh into test/ and tidy .gitignore.
Its cleanup step removes everything under test/ except unit/ and integration/. Now that the script itself lives in test/, it deleted its own tracked file every time it ran (unnoticed in CI, where the checkout is thrown away, but it wiped the file from a local working tree).
@AjayBThorat-20 AjayBThorat-20 changed the title fix(test): stop create-test-projects.sh deleting itself ci: pin actions to commit SHAs, least-privilege permissions, cross-platform matrix Nov 5, 2026
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