Skip to content

feat: bootstrap @socketsecurity/lib + @socketregistry/packageurl-js + @sinclair/typebox via firewall-checked registry fetch#627

Merged
John-David Dalton (jdalton) merged 4 commits intomainfrom
chore/bootstrap-from-registry
Apr 27, 2026
Merged

feat: bootstrap @socketsecurity/lib + @socketregistry/packageurl-js + @sinclair/typebox via firewall-checked registry fetch#627
John-David Dalton (jdalton) merged 4 commits intomainfrom
chore/bootstrap-from-registry

Conversation

@jdalton
Copy link
Copy Markdown
Contributor

@jdalton John-David Dalton (jdalton) commented Apr 27, 2026

Self-landable split from #620.

Adds scripts/bootstrap-firewall-deps.mts that downloads zero-dep Socket-fleet packages from the npm registry tarball directly into node_modules/<scope>/<name>/ BEFORE pnpm install runs. Wired via preinstall lifecycle hook.

Why

setup.mts and other root-script importers fail on a fresh clone because pnpm install hasn't run yet. Pre-seeding from the registry tarball solves the chicken-and-egg.

Bootstrapped packages

In sorted order:

  • @sinclair/typebox — schema runtime used by xport-schema.mts + the setup-security-tools hook
  • @socketregistry/packageurl-js — used by setup tooling
  • @socketsecurity/lib — needed by setup.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 populated alerts array. Network failures are non-fatal — a network blip should not break a fresh clone.

This mirrors the check-firewall.mts helper in socket-registry/.github/actions/lib/.

Behavior

  • Reads pinned version from pnpm-workspace.yaml catalog: OR root package.json deps/devDeps — single source of truth.
  • Skips silently if the package is already resolvable at the matching version.
  • Refuses install if the firewall flagged the package.
  • Uses curl + tar (POSIX, no extra tooling).

Test plan

  • Bootstrap runs locally and pre-seeds all 3 packages with firewall checks
  • CI passes

…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.

A fresh clone now goes `git clone → pnpm install → working repo`,
no special setup ordering required.

Self-landable split from #620.
@jdalton John-David Dalton (jdalton) changed the title feat: bootstrap @socketsecurity/lib from npm registry before pnpm install feat: bootstrap @socketsecurity/lib + @socketregistry/packageurl-js + @sinclair/typebox via firewall-checked registry fetch Apr 27, 2026
@jdalton
Copy link
Copy Markdown
Contributor Author

bugbot run

…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
…p list

socket-sdk-js only uses @socketsecurity/lib; the typebox and
packageurl-js entries were copied from socket-cli's bootstrap (where
xport-schema.mts uses TypeBox) and broke CI here because neither has
a pinned version in this repo's package.json or pnpm-workspace.yaml
catalog. Restoring to a single-package bootstrap.
@jdalton John-David Dalton (jdalton) merged commit d1af774 into main Apr 27, 2026
11 checks passed
@jdalton John-David Dalton (jdalton) deleted the chore/bootstrap-from-registry branch April 27, 2026 19:04
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.

2 participants