feat: bootstrap @socketsecurity/lib + @socketregistry/packageurl-js + @sinclair/typebox via firewall-checked registry fetch#1282
Merged
John-David Dalton (jdalton) merged 3 commits intomainfrom Apr 27, 2026
Conversation
…tall Adds scripts/bootstrap-from-registry.mts that downloads zero-dep Socket packages (currently @socketsecurity/lib) from the npm registry tarball directly into node_modules/<scope>/<name>/ BEFORE pnpm install runs. Wired via package.json preinstall lifecycle hook. Why: setup.mts and other root-script importers of @socketsecurity/lib fail on a fresh clone because pnpm install hasn't run yet. Pre- seeding from the registry tarball solves the chicken-and-egg. Reads pinned version from pnpm-workspace.yaml `catalog:` OR root package.json deps/devDeps — single source of truth, no hardcoded version. Self-landable split from #1279.
b1e236f to
0e55721
Compare
Contributor
Author
|
bugbot run |
Bugbot flagged 3 repo-convention violations on this file: - raw fetch() instead of httpJson - raw rmSync instead of safeDelete - inline e.message instead of errorMessage() All three are intentional. The script runs BEFORE pnpm install, so it cannot import @socketsecurity/lib (the very package it bootstraps). Document the exceptions explicitly in the file header so future readers (and bots) can see the constraint without re-deriving it from the code.
…l-deps The script does more than fetch from the npm registry: it also runs each pinned tarball through Socket Firewall and refuses to install if the firewall returns any alert. The new name reflects both halves of the contract — the firewall verification is the security-critical part that "from registry" obscured. - scripts/bootstrap-from-registry.mts → scripts/bootstrap-firewall-deps.mts - Update package.json preinstall hook to point at the new path - Update User-Agent string and fileoverview to match
Bill Li (billxinli)
approved these changes
Apr 27, 2026
Contributor
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit a29d513. Configure here.
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.
Self-landable split from #1279.
Adds
scripts/bootstrap-firewall-deps.mtsthat downloads zero-dep Socket-fleet packages from the npm registry tarball directly intonode_modules/<scope>/<name>/BEFOREpnpm installruns. Wired viapreinstalllifecycle hook.Why
setup.mtsand other root-script importers fail on a fresh clone becausepnpm installhasn't run yet. Pre-seeding from the registry tarball solves the chicken-and-egg.Bootstrapped packages
In sorted order:
@sinclair/typebox— schema runtime used byxport-schema.mts+ thesetup-security-toolshook@socketregistry/packageurl-js— used by setup tooling@socketsecurity/lib— needed bysetup.mts, postinstall hooks, etc.Firewall verification
Each package version is checked against
firewall-api.socket.dev/purl/<encoded-purl>BEFORE the tarball is downloaded. Any alert in the response means malware (the API does not return informational alerts), so we block unconditionally on a populatedalertsarray. Network failures are non-fatal — a network blip should not break a fresh clone.This mirrors the
check-firewall.mtshelper insocket-registry/.github/actions/lib/.Behavior
pnpm-workspace.yamlcatalog:OR rootpackage.jsondeps/devDeps — single source of truth.curl+tar(POSIX, no extra tooling).Test plan
Note
Medium Risk
Adds a new
preinstallhook that downloads and extracts npm tarballs intonode_modules, which changes install-time behavior and introduces reliance on external network/CLI tools (curl,tar, firewall API). While versions are pinned and malware-checked, failures or environment differences could impact fresh installs.Overview
Ensures fresh clones can run install-time scripts by pre-seeding a small set of zero-dependency packages into
node_modulesbeforepnpm installcompletes.Adds
scripts/bootstrap-firewall-deps.mtsand wires it viapackage.jsonpreinstall; the script reads pinned versions (frompnpm-workspace.yamlcatalog:or rootpackage.json), checks each package/version againstfirewall-api.socket.dev, then fetches the exact registry tarball and extracts it intonode_modules, skipping when the correct version is already present and failing fast when the firewall returns alerts.Reviewed by Cursor Bugbot for commit a29d513. Configure here.