feat: Sandbox implementation with seatbelt

This commit is contained in:
Abhisek Datta
2026-01-08 13:40:22 +05:30
parent 6e830c4c3d
commit ed59693f88
20 changed files with 1235 additions and 0 deletions
+7
View File
@@ -17,6 +17,7 @@ import (
"github.com/safedep/pmg/internal/eventlog"
"github.com/safedep/pmg/internal/ui"
"github.com/safedep/pmg/packagemanager"
"github.com/safedep/pmg/sandbox"
)
type PackageManagerGuardInteraction struct {
@@ -220,6 +221,12 @@ func (g *packageManagerGuard) continueExecution(ctx context.Context, pc *package
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
// Apply sandbox if enabled
pmName := g.packageManager.Name()
if err := sandbox.ApplySandbox(ctx, cmd, pmName, ""); err != nil {
return fmt.Errorf("failed to apply sandbox: %w", err)
}
// We will fail based on executed command's exit code. This is important
// because other tools (scripts, CI etc.) may depend on this exit code.
return cmd.Run()