Add ability to block commands

This commit is contained in:
JY Tan
2025-12-25 19:03:01 -08:00
parent 6159bdd38a
commit 47de3e431c
9 changed files with 909 additions and 0 deletions

View File

@@ -94,6 +94,7 @@ func (m *Manager) Initialize() error {
}
// WrapCommand wraps a command with sandbox restrictions.
// Returns an error if the command is blocked by policy.
func (m *Manager) WrapCommand(command string) (string, error) {
if !m.initialized {
if err := m.Initialize(); err != nil {
@@ -101,6 +102,11 @@ func (m *Manager) WrapCommand(command string) (string, error) {
}
}
// Check if command is blocked by policy
if err := CheckCommand(command, m.config); err != nil {
return "", err
}
plat := platform.Detect()
switch plat {
case platform.MacOS: