A bubblewrap (bwrap) wrapper for sandboxing commands
Project description
bwrapwrap
A bubblewrap wrapper that sandboxes commands with sensible defaults. Network is blocked, the filesystem is read-only (except the current directory), and namespaces are unshared — all with a single command.
Prerequisites
sudo apt install bubblewrap
Optional, for --fork overlay mode:
sudo apt install fuse-overlayfs
Installation
pipx install .
Or for development:
pipx install -e .
Usage
bww [OPTIONS] <command> [args...]
Options
| Flag | Description |
|---|---|
--net |
Allow network access (blocked by default) |
--ptrace |
Allow ptrace (for strace/gdb) |
--fork [NAME] |
Fork ~/.claude via fuse-overlayfs into ~/.bww/NAME/ |
--fork-cleanup |
Delete the fork directory on exit |
--dry-run |
Print the bwrap command without running it |
--help, -h |
Show help |
Examples
# Run a script with no network
bww python3 script.py
# Allow network access
bww --net curl https://example.com
# Run claude with real ~/.claude bound read-write
bww --net claude
# Fork ~/.claude into a copy-on-write overlay
bww --fork --net claude
# Named fork (resumable)
bww --fork=experiment --net claude
# Inspect the generated bwrap command
bww --dry-run echo hello
What gets mounted
| Mount | Mode |
|---|---|
/usr, /lib, /lib64, /bin, /sbin |
read-only |
/etc/alternatives, /etc/fonts, /etc/ssl, /etc/ca-certificates |
read-only |
/proc, /dev |
standard |
/tmp |
tmpfs |
| Current working directory | read-write |
~/.cargo, ~/.rustup (if they exist) |
read-only |
| PATH directories | read-only |
~/.claude/projects/<cwd-session>/ (claude only) |
read-write |
~/.claude/{.credentials.json,settings.json,CLAUDE.md} (claude only) |
read-only |
Claude detection
When the command name contains "claude", bww binds only the project session directory for the current working directory (~/.claude/projects/<encoded-cwd>/) read-write. Shared config files (.credentials.json, settings.json, CLAUDE.md) are bound read-only. Other projects' session data is never exposed. Use --fork to isolate writes into a copy-on-write overlay instead.
Testing
pip install -e ".[test]"
pytest tests/ -v
To test against the original bash script:
SANDBOX_BIN=./sandbox.bash pytest tests/ -v
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bwrapwrap-0.1.1.tar.gz.
File metadata
- Download URL: bwrapwrap-0.1.1.tar.gz
- Upload date:
- Size: 20.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc467e51ce41b1c1640471be3d30ba255c36fd062b51f20559d91bc3b5a1b2c2
|
|
| MD5 |
702480465a5e6971bce50f96952339bc
|
|
| BLAKE2b-256 |
825cf315d5d7d6585e2ffb1692e4eef705e0d291c2b90d4f2cd7d70b2f8e18d4
|
Provenance
The following attestation bundles were made for bwrapwrap-0.1.1.tar.gz:
Publisher:
publish.yml on lirazsiri/bwrapwrap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bwrapwrap-0.1.1.tar.gz -
Subject digest:
bc467e51ce41b1c1640471be3d30ba255c36fd062b51f20559d91bc3b5a1b2c2 - Sigstore transparency entry: 1154341249
- Sigstore integration time:
-
Permalink:
lirazsiri/bwrapwrap@da25258337bc174b57cebadfcff4f17ea6e4157a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/lirazsiri
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@da25258337bc174b57cebadfcff4f17ea6e4157a -
Trigger Event:
release
-
Statement type:
File details
Details for the file bwrapwrap-0.1.1-py3-none-any.whl.
File metadata
- Download URL: bwrapwrap-0.1.1-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05e029636153e311603dffc44bd3b5e737054280d4b9e0253d9e3d29cad993d0
|
|
| MD5 |
7f013a9ca8778a894af99ee75d5c7200
|
|
| BLAKE2b-256 |
40f22f1ca70316305f4d48e1a40ff58355bed0318c0f72c6c20aaa6a3011c93b
|
Provenance
The following attestation bundles were made for bwrapwrap-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on lirazsiri/bwrapwrap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bwrapwrap-0.1.1-py3-none-any.whl -
Subject digest:
05e029636153e311603dffc44bd3b5e737054280d4b9e0253d9e3d29cad993d0 - Sigstore transparency entry: 1154341250
- Sigstore integration time:
-
Permalink:
lirazsiri/bwrapwrap@da25258337bc174b57cebadfcff4f17ea6e4157a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/lirazsiri
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@da25258337bc174b57cebadfcff4f17ea6e4157a -
Trigger Event:
release
-
Statement type: