You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add allow_exec_sugid config option for setuid binary execution (#26)
* feat: add allow_exec_sugid config option (#22)
Add opt-in execution of setuid/setgid binaries for MCP server support.
Resolves forbidden-exec-sugid violations while maintaining secure deny-by-default.
- New ExecSugid enum: Allow(bool) or Paths(Vec<String>)
- Config field with TOML syntax: false (deny), true (allow all), ["/bin/ps"]
- Profile composing with last-wins/paths-union merge semantics
- Config merge: project overrides global, paths are unioned
- CLI flag --allow-exec-sugid PATH (repeatable, path-based only)
- Seatbelt rule generation with path validation
- explain command shows sugid status; init template includes example
- 27 new tests across schema, seatbelt, config, profile, and CLI
* fix(explain): show deny for empty exec_sugid paths list
* docs: add allow_exec_sugid configuration and usage guide
- Add allow_exec_sugid examples to global and project config templates
- Document three modes: deny (default), allow all, allow specific paths
- Add CLI flag usage and merge semantics explanation
- Update PROFILES.md with custom profile example and merge rules
- Add SECURITY.md section explaining deny-by-default behavior and seatbelt rules
- Update generated seatbelt profile example with sugid rule example
* style: format code with cargo fmt
Copy file name to clipboardExpand all lines: CLAUDE.md
-78Lines changed: 0 additions & 78 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,75 +1,5 @@
1
-
# CLAUDE.md
2
-
3
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
-
5
-
## Project Overview
6
-
7
1
`sx` (sandbox-shell) is a Rust CLI that wraps shell sessions and commands in macOS Seatbelt sandboxes. It protects developers from malicious code in npm packages, untrusted repositories, and build scripts by restricting filesystem and network access.
8
2
9
-
## Development Commands
10
-
11
-
```bash
12
-
# Build
13
-
cargo build # Debug build
14
-
cargo build --release # Release build (with LTO)
15
-
16
-
# Test
17
-
cargo test# Run all tests
18
-
cargo test test_name # Run specific test
19
-
cargo test --test cli_test # Run specific integration test file
20
-
21
-
# Run from source
22
-
cargo run -- --help
23
-
cargo run -- echo"test"
24
-
cargo run -- --dry-run online node # Preview seatbelt profile
25
-
```
26
-
27
-
## Architecture
28
-
29
-
The codebase follows a layered architecture with clear separation of concerns:
1. Root literal `(allow file-read* (literal "/"))` is required for path traversal - processes need to read `/` to resolve paths
75
5
2. Seatbelt uses last-match-wins semantics when rules have matching filter types - deny rules after allow rules take precedence for nested paths (e.g., allow `/home` then deny `/home/.ssh`)
@@ -78,14 +8,6 @@ The sandbox uses a **deny-by-default** approach:
78
8
**Configuration Options**:
79
9
-`inherit_base = false` in `.sandbox.toml` skips the base profile for full custom control over allowed paths
80
10
81
-
### Profile System
82
-
83
-
Profiles are composable configurations that stack on top of each other. Order matters - later profiles override network mode but merge filesystem paths.
Copy file name to clipboardExpand all lines: docs/SECURITY.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,20 @@ Everything else (`~/.config/gh`, `~/.netrc`, `~/.gnupg`…) is blocked by deny-b
52
52
53
53
Even with `online`, your credentials can't be read. Can't exfiltrate what you can't see.
54
54
55
+
### Setuid/Setgid Execution
56
+
57
+
Setuid/setgid binaries (e.g., `/bin/ps`, `/usr/bin/newgrp`) are denied by default. Seatbelt raises `forbidden-exec-sugid` when a sandboxed process tries to execute one.
58
+
59
+
Opt in selectively via `allow_exec_sugid`:
60
+
61
+
| Mode | Seatbelt rule |
62
+
|------|---------------|
63
+
| Deny (default) | No rule — blocked by `(deny default)`|
64
+
| Allow all |`(allow process-exec* (with no-sandbox))`|
65
+
| Specific paths |`(allow process-exec (with no-sandbox) (literal "/bin/ps"))`|
66
+
67
+
Paths are validated against injection attacks (no quotes, newlines, or null bytes).
0 commit comments