fix: Enforce sandbox for update commands that may download packages (#220) (#229)

ConfigureSandbox was only triggered by IsInstallationCommand(), missing
update commands (npm update, pnpm update, etc.) that pull new versions
and run postinstall scripts. Use MayDownloadPackages() as the sandbox
signal so all package-downloading commands are sandboxed.

Co-authored-by: Abhisek Datta <abhisek.datta@gmail.com>
This commit is contained in:
Sahil Bansal
2026-04-28 12:19:58 +00:00
committed by GitHub
co-authored by Abhisek Datta
parent 1a983c1dc1
commit 1d9045d770
4 changed files with 63 additions and 5 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ func (f *commonFlow) Run(ctx context.Context, args []string, parsedCmd *packagem
var analyzers []analyzer.PackageVersionAnalyzer
// Configure sandbox based on command type and enforcement policy
config.ConfigureSandbox(parsedCmd.IsInstallationCommand())
config.ConfigureSandbox(parsedCmd.IsInstallationCommand() || parsedCmd.MayDownloadPackages())
cfg := config.Get()