Post

Replies

Boosts

Views

Activity

Can macOS sandbox-exec confine writes to a directory that doesn’t exist yet?
I’m evaluating an offline command-line tool launched from Terminal on macOS. The parent process creates an enclosing directory, then launches the tool through /usr/bin/sandbox-exec -p with an inline profile. The tool must create its own output directory, which is absent at launch. Can a macOS sandbox profile reliably enforce all of the following for that invocation? Allow reads of the tool’s interpreter, dependencies and input files. Deny network access and creation of child processes by the sandboxed tool. Allow the tool to create /path/to/work/proof/producer001 and write beneath it, while denying writes outside that directory, including writes through symlinks or other path aliases. The proposed profile denies file-write* globally and allows it only under a subpath rule for the output directory. Does that exception cover creation of the directory itself when only its parent exists? Does deny process-fork cover all child-process creation paths, including posix_spawn? Is there a supported way to inspect or validate the effective policy for an exact command and working directory before invoking it? If sandbox-exec is unsuitable for this use, is there a supported macOS mechanism for applying these restrictions to a command-line tool launched from Terminal? A documentation reference would be helpful.
0
0
15
1h
Can macOS sandbox-exec confine writes to a directory that doesn’t exist yet?
I’m evaluating an offline command-line tool launched from Terminal on macOS. The parent process creates an enclosing directory, then launches the tool through /usr/bin/sandbox-exec -p with an inline profile. The tool must create its own output directory, which is absent at launch. Can a macOS sandbox profile reliably enforce all of the following for that invocation? Allow reads of the tool’s interpreter, dependencies and input files. Deny network access and creation of child processes by the sandboxed tool. Allow the tool to create /path/to/work/proof/producer001 and write beneath it, while denying writes outside that directory, including writes through symlinks or other path aliases. The proposed profile denies file-write* globally and allows it only under a subpath rule for the output directory. Does that exception cover creation of the directory itself when only its parent exists? Does deny process-fork cover all child-process creation paths, including posix_spawn? Is there a supported way to inspect or validate the effective policy for an exact command and working directory before invoking it? If sandbox-exec is unsuitable for this use, is there a supported macOS mechanism for applying these restrictions to a command-line tool launched from Terminal? A documentation reference would be helpful.
Replies
0
Boosts
0
Views
15
Activity
1h