Add Socket Firewall (free) to shared setup + test workflow#18
Open
oxyc wants to merge 2 commits into
Open
Conversation
Installs the `sfw` binary in the setup composite and uses it to pre-install npm packages in the shared test workflow. Free edition; no token required. Blocks known-malicious npm packages at install time rather than only flagging them after the fact. `sfw npm ci` runs before `composer install:development`, so the subsequent `npm install` invoked by the project's composer build script becomes a no-op against the populated node_modules. Residual gap: any net-new package added by that composer-driven npm install would bypass sfw. Per-project composer scripts can close it by switching to `sfw npm install`.
PATH additions made by Node actions inside composite actions don't reliably propagate to subsequent workflow steps — the first CI run on this branch failed with 'sfw: command not found' after the binary was installed inside the setup composite. Install at the workflow level instead so sfw is available in the next step.
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
Wire Socket Firewall (free edition) into the shared setup composite and test workflow so all consumers automatically get malicious-npm-package interception in CI.
setup/action.yml: installs thesfwbinary viaSocketDev/action@v1.3.2(pinned to SHA), modefirewall-free— no token, no account needed..github/workflows/test.yml: pre-installs npm packages viasfw npm ci --ignore-scriptsbeforecomposer install:development.Why
min-release-age=7d(rolled out to project.npmrcfiles yesterday) protects against fresh malicious packages. But established packages can be compromised mid-life (maintainer takeover, supply-chain injection); cooldowns don't help there. Socket Firewall checks each install against Socket's known-malicious database in real time and aborts the install if a flagged package would be pulled. The free edition does this without any account or API token.How the coverage shapes up
Most of our projects bury
npm installinside a composer build script (e.g. bedrock'sinstall:development→@composer build→npm install).sfwonly intercepts commands explicitly prefixed with it.The pattern here pre-installs via
sfw npm cifirst. The subsequent npm call inside the composer script then sees a populatednode_modulesand a matching lockfile, so it no-ops for everything that was already locked. Residual gap: if the composer-drivennpm installactually adds a net-new package (rare; would need a lockfile mismatch), that single install would bypass sfw.Per-project composer scripts can close the gap by switching their
buildscript'snpm installtosfw npm install— but most repos don't need to bother given the size of the gap.Tradeoffs
sfweither fails closed or open depending on its design; if it blocks builds, that's a new failure mode.Test plan
sfwinvoking npm and reporting on package scan results.composer install:developmentcompletes without re-downloading npm packages (cache hit).Rollout
Merge → consumers using
generoi/github-actions/.github/workflows/test.yml@v1andgeneroi/github-actions/setup@v1inherit the change on next CI run.Follow-ups (not in this PR)
sfw npm cifor full coverage of non-test workflows.sfw npm installconvention in README so per-project composer scripts can opt in.