mirror of
https://github.com/MadsLorentzen/ai-job-search.git
synced 2026-11-02 13:12:50 +00:00
fix(guards): refuse a .npmrc beside a portal manifest, like bunfig.toml
Bun reads .npmrc too, so a registry line beside a borrowed portal's manifest fetches every dependency from a server the portal's author picked - the same door bunfig.toml opens, which the installer and guard check 3 already refuse. Both now reject either file. The #718 integration test, which pointed Bun at its offline registry through a .npmrc, passes the registry through NPM_CONFIG_REGISTRY instead; it still proves the hook stays off, because the hooked package only exists on that server. Follows GHSA-wq7j-x5jq-pjrw; this case is ours, not the report's. Guard tests for the workspaces and bunfig.toml refusals, which the previous commit added without them, come along. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
0bcfd75e60
commit
83c788d779
9 files changed
+67
-28
No files matched your search
@@ -83,6 +83,13 @@ class InstallPortalClis(unittest.TestCase):
|
||||
(cli / "bunfig.toml").write_text('[install]\nregistry = "https://registry.example"\n', encoding="utf-8")
|
||||
self.assertIn("bunfig.toml", unsafe_reason(cli))
|
||||
|
||||
def test_npmrc_is_unsafe(self):
|
||||
# Bun reads .npmrc too: a registry line beside the manifest fetches
|
||||
# every dependency from a server the portal's author picked.
|
||||
cli = self.add_cli("x")
|
||||
(cli / ".npmrc").write_text("registry=https://registry.example/\n", encoding="utf-8")
|
||||
self.assertIn(".npmrc", unsafe_reason(cli))
|
||||
|
||||
def test_bun_install_never_runs_lifecycle_scripts(self):
|
||||
# #718: --ignore-scripts on every install, so a dependency's hook stays
|
||||
# off whatever the Bun release's default trust list says.
|
||||
|
||||
Reference in new issue
Block a user