ci: harden github actions and add a continuous check - #2836
Open
Totara-thib wants to merge 3 commits into
Open
Conversation
Mutable tags are movable pointers: whoever controls an action, or anyone who compromises it, can re-point the tag and the next run executes unreviewed code with the job's token. This repo publishes to npm from CI, so the release path deserves frozen inputs. Same pattern as the tj-actions/changed-files incident (CVE-2025-30066). Pinning to the full commit sha freezes what runs; the version each sha corresponds to stays as a comment. Every sha was resolved from the upstream repository and cross-checked against its release tag. No workflow logic changes.
Without a permissions block the test job's GITHUB_TOKEN inherits the repository default scope. Coverage uploads use the dedicated CODECOV_TOKEN secret and the GitHub token is never used, so contents read is exact. The npm publish and CodeQL workflows already declare scoped permissions and are untouched.
Scans the workflows on each push to master and on pull requests, and fails when something regresses: an unpinned action, a job without a permissions block, a known CVE. The gate passes at 85 points so a single small finding does not block PRs. The config is a small overlay that inherits the CLI's built-in baseline and narrows the branch protection requirement to master, where npm releases cut from. Each run publishes the score to score.getplumber.io, shown as a badge in the README.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2836 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 114 114
Lines 2598 2598
Branches 658 658
=========================================
Hits 2598 2598 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Hi, drive-by CI hardening in three commits, one logical change each.
Commit 1 pins every action to its commit sha, versions kept as comments. A tag like
@v5is a movable pointer: whoever controls the action, or anyone who compromises it, can re-point it and your next run executes their code with the job's token. This repo publishes to npm from CI, so the release path deserves frozen inputs. Same pattern as the tj-actions/changed-files incident (CVE-2025-30066). All shas were resolved from the upstream repos and cross checked against their release tags. The pins stay maintainable: a dependabot config with thegithub-actionsecosystem bumps them automatically, one small block.Commit 2 adds
permissions: contents: readto the CI workflow, the only one without a block. Coverage uploads use your dedicated CODECOV_TOKEN secret and the GitHub token is never used, so the scope is exact. The npm publish and CodeQL workflows already declare scoped permissions and are untouched.Commit 3 adds Plumber to CI, the tool I used to find the issues in the first place, so none of this quietly drifts back:
release/*branches to be protected, the overlay keeps that requirement on master only, where the npm releases cut from. If you would rather protect the release branches instead, delete the overlay and the default applies.One heads up: if the org uses an Actions allowlist in settings, patterns written against tags (like
owner/action@v5) stop matching once refs are shas and workflows refuse to start. Entries need to beowner/action@*in that case.To be fully transparent: I work on Plumber. If you do not want the tool in your CI, no hard feelings, say so and I remove that commit from the PR, the two hardening commits are the part that matters and they stand entirely on their own.
Checklist