mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
chore: Add a landlock test for path deny (#247)
* chore: Add a landlock test for path deny * fix: Make sure sandbox is available:
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/safedep/pmg/internal/analytics"
|
||||
"github.com/safedep/pmg/internal/ui"
|
||||
"github.com/safedep/pmg/internal/version"
|
||||
"github.com/safedep/pmg/sandbox/platform"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@@ -104,6 +105,7 @@ func executeSetupInfo() error {
|
||||
sandboxEntries := make(map[string]string)
|
||||
sandboxEntries["Enabled"] = strconv.FormatBool(sandboxCfg.Enabled)
|
||||
sandboxEntries["Enforce Always"] = strconv.FormatBool(sandboxCfg.EnforceAlways)
|
||||
sandboxEntries["Driver"] = resolveSandboxDriverName()
|
||||
|
||||
if len(sandboxCfg.Policies) > 0 {
|
||||
pmNames := make([]string, 0, len(sandboxCfg.Policies))
|
||||
@@ -145,6 +147,19 @@ func executeSetupInfo() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func resolveSandboxDriverName() string {
|
||||
sb, err := platform.NewSandbox()
|
||||
if err != nil {
|
||||
return "unavailable"
|
||||
}
|
||||
|
||||
if !sb.IsAvailable() {
|
||||
return "unavailable"
|
||||
}
|
||||
|
||||
return sb.Name()
|
||||
}
|
||||
|
||||
// describeCloudCredentials reports whether SafeDep Cloud credentials can be
|
||||
// resolved, and from where. The resolution order matches NewSyncClientBundle:
|
||||
// keychain first, then environment variables. No network calls are made.
|
||||
|
||||
Reference in New Issue
Block a user