mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
fix: Fix sandbox policy generator for MacOS min permissions
This commit is contained in:
@@ -61,7 +61,8 @@ func (s *seatbeltSandbox) Execute(ctx context.Context, cmd *exec.Cmd, policy *sa
|
||||
}
|
||||
|
||||
log.Debugf("Seatbelt profile written to %s", s.tempProfilePath)
|
||||
log.Debugf("Seatbelt profile content:\n%s", sbProfile)
|
||||
|
||||
debugLogPolicyContent(sbProfile)
|
||||
|
||||
// Modify command to run via sandbox-exec
|
||||
originalPath := cmd.Path
|
||||
@@ -113,3 +114,15 @@ func (s *seatbeltSandbox) Close() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// debugLogPolicyContent logs the policy content when explicitly debugging is enabled.
|
||||
func debugLogPolicyContent(content string) {
|
||||
filePath := os.Getenv("PMG_SANDBOX_DEBUG_LOG_SEATBELT_POLICY_CONTENT")
|
||||
if filePath == "" {
|
||||
return
|
||||
}
|
||||
|
||||
if err := os.WriteFile(filePath, []byte(content), 0600); err != nil {
|
||||
log.Warnf("failed to write seatbelt policy content to %s: %v", filePath, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user