docs: clarify trustedDependencies replaces the default allow list#31027
Conversation
|
Updated 11:36 PM PT - May 18th, 2026
✅ @autofix-ci[bot], your commit d86b8a35592e34c33db4092bf6901912c83d8ff9 passed in 🧪 To try this PR locally: bunx bun-pr 31027That installs a local version of the PR into your bun-31027 --bun |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughUpdated ChangesLifecycle script trusted dependencies documentation
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/pm/lifecycle.mdx`:
- Line 66: Reword the ambiguous sentence about trustedDependencies to clearly
state that defining trustedDependencies replaces the default allow list; update
the line mentioning "To trust a specific subset of packages, list them
explicitly — you do not need to re-list entries from the default list for
packages you already depend on." to something like: "To trust a specific subset
of packages, list them explicitly. Because defining trustedDependencies replaces
the default list, include only the packages you want to trust." Keep references
to trustedDependencies and --ignore-scripts intact.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: baad4860-dcab-471a-bd91-9ff9c291f0da
📒 Files selected for processing (1)
docs/pm/lifecycle.mdx
|
Found 2 issues this PR may fix:
🤖 Generated with Claude Code |
|
Re: find-issues-bot — intentionally not adding `Fixes` for #7642 or #12855. Both are open feature requests (#7642 wants an interactive prompt; #12855 wants an |
There was a problem hiding this comment.
LGTM — thanks for the reword in 4003b70, the follow-up paragraph now matches the implementation. Left one non-blocking nit inline about the "~500" figure.
Extended reasoning...
Overview
Docs-only change: adds a 12-line subsection to docs/pm/lifecycle.mdx with a three-row table explaining that trustedDependencies replaces Bun's built-in allow list rather than extending it, and covering the omitted / non-empty / [] cases. No code, build, or config changes.
Security risks
None. This is prose in a .mdx file; it does not affect which lifecycle scripts Bun actually executes. The only external link added points to a file within this same repo on github.com.
Level of scrutiny
Low. The behavior described was verified against Lockfile.hasTrustedDependency in src/install/lockfile.zig and the parser in src/install/lockfile/Package.zig (cited in the PR description and re-checked during my first review). I confirmed sharp and esbuild — now named as examples — are present at lines 309 and 163 of default-trusted-dependencies.txt. docs/ has no CODEOWNERS entry.
Other factors
- My earlier blocking comment (the closing clause that read as the inverse of the actual semantics) was addressed in 4003b70 and the thread is resolved; the new wording is accurate.
- CodeRabbit's overlapping concern is also resolved.
- The one remaining finding is a nit: the table says "~500 packages" but the file has 367 entries. This figure is inherited from the pre-existing "top 500" wording two paragraphs up (line 47), so the new row is internally consistent with surrounding docs, links directly to the source file, and doesn't affect the replace-vs-extend semantics this PR exists to clarify. Not a blocker.
There was a problem hiding this comment.
LGTM — thanks for addressing both rounds of feedback; the final wording accurately reflects the replace-not-extend semantics.
Extended reasoning...
Overview
This PR touches a single docs file, docs/pm/lifecycle.mdx, adding a subsection that clarifies trustedDependencies replaces Bun's default allow list rather than extending it, with a three-row table covering omitted / non-empty / empty-array cases. It also rewords the pre-existing "top 500" line to be count-neutral.
Security risks
None. This is documentation only — no code, config, or build changes. The content describes existing security-relevant behavior more accurately than before, which is a net positive for users.
Level of scrutiny
Low. Docs-only change to an .mdx file with no executable content. The technical claims were verified against src/install/lockfile.zig:2126-2134 (hasTrustedDependency) and the parser behavior in src/install/lockfile/Package.zig, and they are correct: a non-null trusted_dependencies (set whenever the key is present) bypasses the default list entirely. The sharp/esbuild examples named in the new prose are confirmed present in src/install/default-trusted-dependencies.txt.
Other factors
I left two inline comments on earlier revisions (a misleading closing clause that contradicted the table, and a stale "~500" figure). Both were addressed in commits 4003b70 and 37e98da respectively, and CodeRabbit's overlapping nit was resolved by the same fix. The author also correctly declined to auto-close unrelated feature-request issues. The autofix bot applied formatting in d86b8a3 and CI is green. No CODEOWNERS entry covers docs/. Nothing remains outstanding.
|
I tried this with Bun v1.3.14 using "trustedDependencies": [] and bun pm untrusted, but it did not block the default trusted list. However, adding at least one entry did work and prevented the default list from being applied, e.g.: "trustedDependencies": ["cypress"] |
What
Closes #31026.
The
trustedDependenciesdocs atdocs/pm/lifecycle.mdxdon't explain what happens when the field is set to an empty array. Users reasonably assume"trustedDependencies": []would add nothing on top of the default top-500 list — but it actually disables the default list entirely.Behavior (verified against source)
From
Lockfile.hasTrustedDependencyinsrc/install/lockfile.zig:2126:The parser (
src/install/lockfile/Package.zig:1556) initialiseslockfile.trusted_dependenciesto a non-null empty map the moment thetrustedDependencieskey is present — even if the array is empty. So the fallback to the default list is only reached when the key is absent frompackage.json. Three cases:package.json["pkg"]pkg— default list ignored[]Change
Adds a short subsection + table to
docs/pm/lifecycle.mdxcovering all three cases, and notes that the field replaces rather than extends the default list. Docs-only, no code changes.