mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
fix: Handle the case when package manager policy is explicitly disabled
This commit is contained in:
@@ -41,8 +41,14 @@ func ApplySandbox(ctx context.Context, cmd *exec.Cmd, pmName string) (*sandbox.E
|
|||||||
log.Debugf("Looking up sandbox policy for %s", pmName)
|
log.Debugf("Looking up sandbox policy for %s", pmName)
|
||||||
|
|
||||||
policyRef, exists := cfg.Config.Sandbox.Policies[pmName]
|
policyRef, exists := cfg.Config.Sandbox.Policies[pmName]
|
||||||
if !exists || !policyRef.Enabled {
|
if !exists {
|
||||||
return nil, fmt.Errorf("no sandbox policy enabled for %s", pmName)
|
return nil, fmt.Errorf("no sandbox policy configured for %s", pmName)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The policy is explicitly disabled for this package manager, so we skip sandbox
|
||||||
|
if !policyRef.Enabled {
|
||||||
|
log.Warnf("sandbox policy %s is explicitly disabled for %s, skipping sandbox", policyRef.Profile, pmName)
|
||||||
|
return sandbox.NewExecutionResult(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("Loading sandbox policy %s", policyRef.Profile)
|
log.Debugf("Loading sandbox policy %s", policyRef.Profile)
|
||||||
|
|||||||
Reference in New Issue
Block a user