console: enable npmMinimalAgeGate (3d) and bump Yarn to 4.14.1#36196
Open
jasonhernandez wants to merge 3 commits intomainfrom
Open
console: enable npmMinimalAgeGate (3d) and bump Yarn to 4.14.1#36196jasonhernandez wants to merge 3 commits intomainfrom
jasonhernandez wants to merge 3 commits intomainfrom
Conversation
Adds a 3-day publish-age cooldown on npm installs to reduce exposure to zero-day supply chain attacks. Requires Yarn 4.10+, so this also bumps the pinned Yarn from 4.3.1 to 4.14.1 (current stable 4.x). `enableScripts: true` is set explicitly — it was implicit under 4.3 and postinstall is required for @sentry/cli and msw. `npmPreapprovedPackages` is seeded empty as the documented escape hatch for future exceptions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Tightens the supply-chain posture set up in the previous commit. The earlier claim that @sentry/cli and msw strictly required postinstall scripts turned out to be wrong: - @sentry/cli ships its binary via platform-specific optional deps (@sentry/cli-darwin, @sentry/cli-linux-x64, etc), not postinstall. sentry-cli --version works without any script ever running. - esbuild uses the same optional-deps pattern. - msw's postinstall only copies a browser service worker. The console uses msw/node exclusively (no setupWorker / msw/browser references anywhere in src/), so the service worker file is unused. - core-js's postinstall is a support-message console.log, never required. Verified: yarn install --immutable, yarn typecheck, yarn lint, yarn test --run, yarn build (with SENTRY_RELEASE set) all succeed without any package lifecycle scripts executing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Motivation
Harden the console's npm supply chain against zero-day compromised package releases. Several recent npm malware events (dependency takeovers, postinstall exploits) have been caught by the community within days of publication, but a CI/dev install that happens to run during that window can pull in the bad version before detection. Yarn 4.10+ ships
npmMinimalAgeGate, which blocks installation of packages published more recently than a configurable cooldown. This adopts it.Description
npmMinimalAgeGate: "3d"inconsole/.yarnrc.yml. Packages published within the last 3 days will be excluded from resolution.npmPreapprovedPackages: []with a comment explaining its purpose — the documented escape hatch if we ever need to bypass the gate for a specific descriptor or scope.packageManager/volta.yarnfrom4.3.1→4.14.1(current stable 4.x). The gate requires Yarn 4.10+.enableScriptsat its default (false). This is a second supply-chain win: no third-party package lifecycle scripts run on install. The four packages that declare scripts (@sentry/cli,msw,esbuild,core-js) are all functional without them — binary tools ship via platform-specific optional deps, msw is used only in node-mode in our tests, and core-js's postinstall is just a support message.yarn.lockmetadata bumpsversion: 8→9(Yarn 4.14 lockfile format). The only other line inside is a TypeScript compat-patch hash rotation — internal to Yarn's patching, harmless. No CI scripts or Dockerfiles need updating; every install site already runscorepack enable+yarn install --immutableand followspackageManagerfrompackage.json.Risks / watch-outs for reviewers:
corepack enableto pick up the new pin. CI is fine (already runscorepack enable). Worth a team heads-up.yarn add foo@lateston a package published within the last 3 days, Yarn reports "not found" rather than "blocked by age gate." Confusing but not damaging. Escape hatch isnpmPreapprovedPackages.cooldownfield — we should keep these aligned at 3 days.dependenciesMetainpackage.json, not a globalenableScripts: true.Verification
Locally on this branch, with
enableScriptsat the default (off) and nodependenciesMetaallowlist:yarn install(fresh, emptynode_modules/) — completes. YN0004 warns that build scripts are disabled for@sentry/cli,msw,esbuild,core-js, but nothing downstream actually needs them (see below).yarn install --immutable(CI-style) — clean.yarn typecheck— passes.yarn lint— passes.yarn test --run— 6 tests fail, same 6 fail on main baseline with Yarn 4.3.1. Failures are a pre-existingSet.prototype.difference is not a functionissue (requires Node 22+,volta.nodeis pinned to 20.12.2). Not caused by this PR.yarn build:local— succeeds (esbuild works without postinstall; platform binary from@esbuild/darwin-arm64).yarn build(withSENTRY_RELEASE=test-build) — succeeds.sentry-clibinary is present and callable via@sentry/cli-darwinoptional dep;@sentry/vite-plugincan invoke it.node .../node_modules/@sentry/cli/bin/sentry-cli --version→sentry-cli 2.58.5. Works without the postinstall having run.grepacross the repo confirms msw's service worker (setupWorker/msw/browser/mockServiceWorker) is not referenced anywhere inconsole/src. msw is used exclusively in node mode for unit tests.Still to confirm:
yarn add <package>@<fresh-version>rejects as expected.