fix: add npm-shrinkwrap.json to lock transitive dependencies in distributed packages#13458
fix: add npm-shrinkwrap.json to lock transitive dependencies in distributed packages#13458
Conversation
….json The framework-dist tarball is extracted by the Go binary installer and npm-installed without a lockfile, allowing transitive dependencies to resolve fresh from the registry. This exposed users to supply chain attacks on transitive deps (e.g. axios via aws-crt). Exclude framework-dist from the npm workspace (it was never needed as a workspace member — nothing imports it, esbuild marks its deps as external, no lifecycle scripts) and add an npm-shrinkwrap.json that locks the entire dependency tree. npm pack auto-includes it in the tarball, and npm install on user machines respects it. Add a separate Dependabot entry for framework-dist with the same cooldown policy to keep the shrinkwrap updated. Closes #13453 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…pendencies The published serverless npm package ships without a lockfile, so npm install serverless resolves transitive deps fresh from the registry. Add npm-shrinkwrap.json to pin the full dependency tree. Exclude sf-core-installer from the workspace to enable shrinkwrap generation (it has no reason to be a workspace member — nothing imports it and npm publish works independently). Add a separate Dependabot entry with the same cooldown policy. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
📝 WalkthroughWalkthroughAdded Dependabot npm update jobs for two packages, excluded those packages from the root npm workspace, removed an axios override in framework-dist, and added an npm shrinkwrap lockfile for packages/sf-core-installer pinning serverless and transitive deps. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@cursor review |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/dependabot.yml:
- Around line 96-105: The Dependabot block for package-ecosystem: 'npm' and
directory: '/packages/sf-core-installer' is missing ignore entries for undici
and rimraf; add ignore constraints that pin undici to <7.0.0 and rimraf to
<6.0.0 (or explicitly ignore versions >=7.0.0 and >=6.0.0) within that
per-directory block so Dependabot won't open major-version PRs that drop Node 18
support for the sf-core-installer package.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a8613941-9764-4b07-9ee8-455a4f01a506
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
.github/dependabot.ymlpackage.jsonpackages/framework-dist/npm-shrinkwrap.jsonpackages/sf-core-installer/npm-shrinkwrap.json
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b906eb0aa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@cursor review |
…dabot entry rimraf is only used by sf-core-installer, so move its ignore rule there. undici is used by both sf-core-installer and packages/util, so copy the ignore rule to sf-core-installer while keeping it on root. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@cursor review |
Summary
npm-shrinkwrap.jsontopackages/framework-distandpackages/sf-core-installerto pin all transitive dependencies, further hardening against supply chain attacksRoot cause
Both distributed packages (
framework-disttarball andsf-core-installernpm package) ship without a lockfile. When dependencies are installed on user machines, transitive deps resolve fresh from the registry — allowing a compromised transitive package to be pulled in.Related
Test plan
npm pack --dry-runconfirmsnpm-shrinkwrap.jsonis included in both tarballsnpm installrespects shrinkwrap by pinning a transitive dep to an older version and confirming it installs that version instead of latestnpm publishworks correctly for sf-core-installer when excluded from workspacenpm installandnpm cisucceed after workspace exclusionsNote
Medium Risk
Medium risk because it changes workspace membership and introduces per-package
npm-shrinkwrap.jsonfiles, which can affect install/publish behavior and dependency resolution for the distributed artifacts.Overview
Pins transitive dependencies for shipped npm artifacts. Adds
npm-shrinkwrap.jsontopackages/framework-distandpackages/sf-core-installerso installs of those published packages resolve exact dependency trees.Updates the root
package.json/package-lock.jsonworkspace config to exclude those two directories (marking them as extraneous in the lockfile) to enable shrinkwrap generation, and extends.github/dependabot.ymlwith separate weekly update entries (including Node 18-related ignores forsf-core-installer).Written by Cursor Bugbot for commit f5bf19c. This will update automatically on new commits. Configure here.
Summary by CodeRabbit