feat: add Bun and npm lockfile scrub action - #10
Draft
peakematt wants to merge 3 commits into
Draft
Conversation
Restore Socket Firewall Bun tarball URL fields to Bun native empty resolution fields. Spec: docs/ideation/bun-lockfile-socket-firewall-scrub/spec-phase-1.md
Add explicit workspace-relative lockfile selection, preserve Bun defaults, and normalize npm resolved URL fields without reformatting. Cover npm lockfile versions 1–3 and shrinkwrap with tests and CI install smokes. Spec: docs/ideation/bun-lockfile-socket-firewall-scrub/spec-phase-1.md
Preserve upstream public-token and fork-fallback behavior alongside npm scrub tests. Run the protected scrub smoke only when Socket Firewall is active.
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.
Socket Firewall registry URLs saved in lockfiles can bind later installs to an endpoint that contributors or external CI cannot access. Bun can record these URLs directly; npm has
omit-lockfile-registry-resolved=trueto prevent them, but a reusable cleanup backstop is useful when that configuration is absent.This adds
workos/setup-socket-firewall/lockfile-scrubwith format-specific behavior: Bunbun.lockURLs become Bun's native empty resolved-URL field, while npmpackage-lock.jsonandnpm-shrinkwrap.jsonversions 1–3 retain their tarball URLs with the canonicalregistry.npmjs.orghost. The npm transform changes onlyresolvedstring values and preserves formatting, paths, query strings, fragments, versions, and integrity hashes.The action handles one workspace-relative
lockfilepath per invocation, including nested paths, and defaults tobun.lock.checkreportschangedwithout modifying the file;applyperforms the repair. Missing or unsupported files, traversal, symlinked paths, and malformed npm JSON fail without changing the original. The action installs nothing, receives no token, and never commits. Caller workflows own any same-repositoryGITHUB_TOKENcommit; those commits do not trigger another Actions run, so file validation must not be mistaken for fresh-head application CI.The npm helper is included in the allowlisted action-only release. No consumer rollout is enabled by this PR: the four Bun repositories in HELP-723 still need separate workflows pinned to the signed release SHA after merge. Yarn and pnpm scrubbing are not included.
From the repository root, with Bash and Node.js 22+ (no dependency installation needed):
These checks passed locally and cover transformations, unchanged check-mode bytes, idempotence, path rejection, and execution from the packaged release tree. Local
npm ci --ignore-scriptsprobes also passed for both npm filenames across versions 1–3, with each lockfile unchanged after installation. The existing configure, teardown, and release-publisher tests, ShellCheck, and pinned shfmt checks passed as well.CI adds the same six npm install combinations using the actual composite action, plus a scrubbed-lockfile install in the existing token-backed job with public registry DNS blocked. That protected behavior requires the CI run; it is not established by the local public-registry probes.
Tracking: https://linear.app/workos/issue/HELP-723