Skip to content

Commit 79e1993

Browse files
authored
docs: rewrite for clarity and supply chain focus (#18)
* docs: rewrite documentation for clarity and supply chain focus - Emphasize supply chain attack prevention as primary threat - Add bun profile throughout (completions, aliases, examples) - Remove unsupported allow_domains/deny_domains from config - Update deny_read list to match base.toml - Fix shell integration setup instructions - Add sxb alias for bun workflow - Apply humanizer rules: remove AI patterns, add direct voice - Consolidate redundant sections in README - Ensure consistency across README and all docs/ * docs: remove redundant TL;DR and unnecessary personal comment
1 parent b644da0 commit 79e1993

8 files changed

Lines changed: 393 additions & 496 deletions

File tree

README.md

Lines changed: 170 additions & 194 deletions
Large diffs are not rendered by default.

docs/CONFIGURATION.md

Lines changed: 53 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,68 @@
11
# Configuration
22

3-
`sx` uses a layered configuration system with global, project, and CLI options.
3+
`sx` uses a layered configuration system: global config, project config, CLI flags.
44

5-
## Configuration Files
5+
## Global Config (`~/.config/sx/config.toml`)
66

7-
### Global Configuration
8-
9-
Location: `~/.config/sx/config.toml`
7+
Your personal paths. Terminal, shell prompt, directory jumper…
108

119
```toml
1210
[sandbox]
1311
default_network = "offline" # offline | online | localhost
14-
default_profiles = ["base"] # profiles to always include
15-
shell = "/bin/zsh" # shell to use inside sandbox
16-
prompt_indicator = true # show sandbox indicator in prompt
17-
log_file = "~/.sx/violations.log"
12+
default_profiles = ["base"] # always include these
13+
shell = "/bin/zsh" # shell inside sandbox
14+
prompt_indicator = true # show [sx:mode] in prompt
15+
inherit_base = true # include base profile
1816

1917
[filesystem]
20-
allow_read = ["/usr", "/bin"] # paths to allow reading
21-
deny_read = ["~/.ssh", "~/.aws"] # paths to deny reading
22-
allow_write = ["/tmp"] # paths to allow writing
23-
24-
[network]
25-
allow_domains = [] # domains to allow when online
26-
deny_domains = [] # domains to block even when online
18+
allow_read = [
19+
# Shell prompt
20+
"~/.config/starship.toml",
21+
"~/.cache/starship/",
22+
23+
# zoxide
24+
"~/.local/share/zoxide/",
25+
26+
# Ghostty users - required or terminal breaks
27+
"/Applications/Ghostty.app/Contents/Resources/terminfo",
28+
]
29+
allow_write = [
30+
"~/.local/share/zoxide/",
31+
"~/Library/Application Support/zoxide/",
32+
"~/.cache/",
33+
]
34+
deny_read = [] # additional paths to block
2735

2836
[shell]
29-
pass_env = ["TERM", "PATH"] # env vars to pass through
30-
deny_env = ["AWS_*", "*_SECRET*"] # env vars to block
37+
pass_env = ["CUSTOM_VAR"] # env vars to pass through
38+
deny_env = ["*_SECRET*"] # env vars to block (wildcards)
39+
set_env = { CI = "true" } # env vars to set inside sandbox
3140
```
3241

33-
### Project Configuration
42+
## Project Config (`.sandbox.toml`)
3443

35-
Location: `.sandbox.toml` in project root
44+
Per-project overrides. Create with `sx --init`.
3645

3746
```toml
3847
[sandbox]
39-
inherit_global = true # inherit from global config
40-
profiles = ["rust", "online"] # additional profiles for this project
48+
profiles = ["rust"] # profiles for this project
4149
network = "localhost" # override network mode
50+
inherit_global = true # inherit from global config
51+
inherit_base = true # include base profile (false for full custom)
4252

4353
[filesystem]
44-
allow_read = ["./target"]
54+
allow_read = ["./vendor"]
55+
allow_write = ["./target", "/tmp/build"]
4556
deny_read = ["./secrets"]
46-
allow_write = ["./target", "./build"]
4757

4858
[shell]
49-
pass_env = ["RUST_LOG"]
50-
set_env = { CI = "true" }
59+
pass_env = ["RUST_LOG", "NODE_ENV"]
60+
set_env = { DEBUG = "1" }
5161
```
5262

53-
## Configuration Precedence
54-
55-
1. CLI flags (highest priority)
56-
2. Project config (`.sx.toml`)
57-
3. Global config (`~/.config/sx/config.toml`)
58-
4. Built-in defaults (lowest priority)
59-
60-
## Network Modes
61-
62-
| Mode | Description |
63-
|------|-------------|
64-
| `offline` | Block all network access (default) |
65-
| `online` | Allow all network access |
66-
| `localhost` | Allow only localhost (127.0.0.1) connections |
67-
68-
## Filesystem Rules
69-
70-
- **allow_read**: Paths the sandbox can read from
71-
- **deny_read**: Paths explicitly denied (overrides allows)
72-
- **allow_write**: Paths the sandbox can write to (besides working directory)
73-
74-
The working directory always has full read/write access.
75-
76-
## Environment Variables
77-
78-
- **pass_env**: Environment variables passed into the sandbox
79-
- **deny_env**: Environment variables blocked (supports wildcards)
80-
- **set_env**: Environment variables to set inside the sandbox
81-
82-
### Wildcard Patterns
83-
84-
Environment variable patterns support wildcards:
85-
- `AWS_*` - matches any variable starting with `AWS_`
86-
- `*_SECRET*` - matches variables containing `_SECRET`
87-
- `*_KEY` - matches variables ending with `_KEY`
88-
8963
## Custom Profiles
9064

91-
Create custom profiles in `~/.config/sx/profiles/`:
65+
Create in `~/.config/sx/profiles/`:
9266

9367
```toml
9468
# ~/.config/sx/profiles/myproject.toml
@@ -101,3 +75,19 @@ allow_write = ["~/.myproject/cache"]
10175
[shell]
10276
pass_env = ["MYPROJECT_TOKEN"]
10377
```
78+
79+
Use with `sx myproject -- command`.
80+
81+
## Precedence
82+
83+
1. CLI flags (highest)
84+
2. Project config (`.sandbox.toml`)
85+
3. Global config (`~/.config/sx/config.toml`)
86+
4. Built-in defaults (lowest)
87+
88+
## Environment Wildcards
89+
90+
`deny_env` supports wildcards:
91+
- `AWS_*` - matches `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`
92+
- `*_SECRET*` - matches `DATABASE_SECRET`, `MY_SECRET_KEY`
93+
- `*_KEY` - matches `API_KEY`, `SSH_KEY`

docs/PROFILES.md

Lines changed: 59 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,101 @@
11
# Profiles
22

3-
Profiles are composable sandbox configurations that can be combined to create the right security posture for your project.
3+
Profiles are composable sandbox configs. Stack them: `sx online rust -- cargo build`
44

55
## Built-in Profiles
66

77
### base
88

9-
The foundational profile included by default. Provides:
10-
- Read access to system directories (`/usr`, `/bin`, `/sbin`, `/opt`)
11-
- Read access to temp directories (`/tmp`, `/var/folders`)
12-
- Denies access to sensitive directories (`~/.ssh`, `~/.aws`, `~/.gnupg`)
13-
- Basic environment variables (`TERM`, `PATH`, `HOME`, `USER`)
9+
Always included (unless `inherit_base = false`). Provides:
10+
- Read access to system directories (`/usr`, `/bin`, `/sbin`, `/Library`, `/System`)
11+
- Read access to shell configs (`~/.zshrc`, `~/.bashrc`…)
12+
- Write access to `/tmp` and session temp dir
13+
- Basic env vars (`TERM`, `PATH`, `HOME`, `USER`, `SHELL`)
14+
15+
**Always denied** (even if you allow `~`):
16+
- `~/.ssh`
17+
- `~/.aws`
18+
- `~/.docker/config.json`
19+
- `~/Documents`, `~/Desktop`, `~/Downloads`
1420

1521
### online
1622

17-
Enables full network access.
23+
Full network access.
1824

1925
```bash
20-
sx --profile online
26+
sx online -- curl https://example.com
2127
```
2228

2329
### localhost
2430

25-
Allows network connections only to localhost (127.0.0.1).
31+
127.0.0.1 only. For dev servers.
2632

2733
```bash
28-
sx --profile localhost
34+
sx localhost -- npm start
2935
```
3036

3137
### rust
3238

33-
For Rust projects:
34-
- Read access: `~/.cargo`, `~/.rustup`
35-
- Write access: `~/.cargo/registry`
36-
- Network domains: `crates.io`, `static.crates.io`
39+
Rust/Cargo toolchain:
40+
- Read/write: `~/.cargo`, `~/.rustup`
41+
- Env: `CARGO_HOME`, `RUSTUP_HOME`
42+
43+
```bash
44+
sx rust online -- cargo build
45+
```
46+
47+
### bun
48+
49+
Bun runtime:
50+
- Read/write: `~/.bun`
51+
- Parent directory listing for module resolution (`/Users`, `~`)
52+
- Env: `BUN_INSTALL`, `NODE_ENV`
3753

3854
```bash
39-
sx --profile rust
55+
sx bun online -- bun install
4056
```
4157

4258
### claude
4359

44-
For Claude Code projects:
45-
- Read/Write access: `~/.claude`
46-
- Network domains: `api.anthropic.com`
47-
- Passes: `ANTHROPIC_API_KEY`
60+
Claude Code:
61+
- Read/write: `~/.claude`, `~/.claude.json`
62+
- Includes `online` network
63+
- Env: `ANTHROPIC_API_KEY`
4864

4965
```bash
50-
sx --profile claude
66+
sx claude -- claude --dangerously-skip-permissions --continue
5167
```
5268

5369
### gpg
5470

55-
For GPG signing:
56-
- Read/Write access: `~/.gnupg`
71+
GPG signing:
72+
- Read/write: `~/.gnupg`
5773

5874
```bash
59-
sx --profile gpg
75+
sx gpg -- git commit -S -m "signed"
6076
```
6177

62-
## Profile Composition
78+
## Combining Profiles
6379

64-
Profiles can be combined. The order matters for network mode (last one wins):
80+
Order matters for network mode (last wins). Filesystem paths merge.
6581

6682
```bash
67-
# Rust project with full network access
83+
# Rust with network
6884
sx rust online -- cargo build
6985

70-
# Rust project with localhost only
71-
sx rust localhost -- cargo test
86+
# Rust offline (tests with cached deps)
87+
sx rust -- cargo test
7288

73-
# GPG signing with network access
74-
sx gpg online -- git commit -S -m "signed commit"
89+
# Claude with GPG signing
90+
sx claude gpg -- claude --dangerously-skip-permissions
91+
92+
# Bun with network
93+
sx bun online -- bun install
7594
```
7695

7796
## Custom Profiles
7897

79-
Create custom profiles in `~/.config/sx/profiles/` or `./profiles/`:
98+
Create in `~/.config/sx/profiles/`:
8099

81100
```toml
82101
# ~/.config/sx/profiles/mycompany.toml
@@ -86,33 +105,27 @@ network_mode = "online"
86105
allow_read = ["/opt/mycompany"]
87106
allow_write = ["~/.mycompany/cache"]
88107

89-
[network]
90-
allow_domains = ["api.mycompany.com", "*.internal.mycompany.com"]
91-
92108
[shell]
93109
pass_env = ["MYCOMPANY_TOKEN"]
94110
```
95111

96112
Use it:
97113

98114
```bash
99-
sx --profile mycompany
115+
sx mycompany -- ./run.sh
100116
```
101117

102-
## Profile Merging Rules
103-
104-
When multiple profiles are composed:
105-
106-
1. **Network mode**: Last profile with a network mode wins
107-
2. **Filesystem paths**: Union of all paths (no duplicates)
108-
3. **Network domains**: Union of all domains
109-
4. **Environment variables**: Union of all pass/deny lists
118+
## Project Profiles
110119

111-
## Project-Specific Profiles
112-
113-
Define profiles in `.sandbox.toml`:
120+
In `.sandbox.toml`:
114121

115122
```toml
116123
[sandbox]
117124
profiles = ["rust", "localhost"]
118125
```
126+
127+
## Merging Rules
128+
129+
1. **Network mode:** last profile with a mode wins
130+
2. **Filesystem paths:** union (no duplicates)
131+
3. **Env vars:** union of pass/deny lists

0 commit comments

Comments
 (0)