Hozo
Simple wrapper around bubblewrap (Linux) and sandbox-exec / Seatbelt (macOS) that provides composable profiles for sandboxing. The backend is chosen automatically by platform; the CLI and profiles are the same on both.
Read/write/network access are all deny by default except for a minimal set of directories.
Note: Hozo is not a full isolation solution, but it does make it easier to run untrusted code with a sane default policy and a few composable profiles. This won't protect you against entirely malicious code or kernel exploits, but will help avoid accidentally leaking secrets/files, and also reduce the blast radius of a misbehaving tool. On Linux it uses bubblewrap (kernel namespaces); on macOS it uses Seatbelt, which filters filesystem/network access but does not isolate processes (no separate PID namespace), so isolation there is weaker.
Requirements
- Linux with
bubblewrap(bwrap), or macOS withsandbox-exec(ships with macOS). - Python ≥ 3.11. On Linux, proxy mode also needs
python3inside the sandbox (for the egress bridge); macOS needs nothing extra.
Install
uv tool install hozo
hozo --help
Quick start
hozo +untrusted -- make test # no network, no secrets, cwd writable
hozo +untrusted -- bash # sandboxed shell
hozo explain +untrusted -- echo hi # shows the resolved policy (bwrap args / SBPL profile)
hozo +node +proxy -- npm install # network limited to the npm registry
hozo --allow-net=pypi.org -- pip install requests # grant just this host
hozo --allow-read=/etc/hosts +untrusted -- cat /etc/hosts
hozo profile list # built-in + your profiles
By default, the current directory is mounted read-write at the same path inside the sandbox. So if you're in /home/user/myproject, then /home/user/myproject is mounted read-write inside the sandbox. Other adjacent directories like /home/user/myotherproject are NOT visible.
This allows you to run commands like make or pytest in a sandboxed environment without worrying about them accessing other files on your system.
Profiles
Profiles are composable YAML files that define what is allowed inside the sandbox. Multiple profiles can be combined and merged to create a final policy for the sandbox.
Several built-in profiles are provided with Hozo, but you can create your own custom profiles by putting them in ~/.config/hozo/profiles/<name>.yaml. Built-in profiles can also be overridden by a user profile of the same name.
hozo profile list shows what's available. hozo explain +a +b -- cmd shows the merged result.
Policies
Profiles are deny-by-default. The base profile always applies, and other profiles can be added to grant more access.
Network is also off by default. The +proxy profile enables egress through a host-side proxy, but still allows no hosts by default. Grant hosts with --allow-net=HOST,HOST.
Ad-hoc allows can be granted on the cli:
--allow-net=HOST,HOSTallows connecting to these hosts via the proxy--allow-netwith no value opens full host networking, no proxy required--allow-read=PATH,PATH/--allow-write=PATH,PATHallows reading/writing to specific paths.
Network egress
Network egress is off by default. There are three modes:
- Allow all egress.
- Allow egress to specific hosts.
- No egress at all.
hozo +proxy -- curl https://pypi.org/ # blocked: no hosts granted
hozo --allow-net=pypi.org -- curl https://pypi.org/simple/ # 200
hozo --allow-net=pypi.org -- curl https://example.com/ # blocked: 403
hozo +python +proxy -- uv pip install ruff # +python grants PyPI, +proxy enables egress
Everyday use
To launch a tool sandboxed without typing the full command each time, use a shell alias:
alias claude='hozo +claude -- claude'
A tool starts with a clean home: $HOME keeps its real path, but nothing under it is visible unless a profile binds it explicitly. To persist a tool's login/config, bind its config dir read-write in a profile — it's made available at the same path inside the sandbox:
# ~/.config/hozo/profiles/mytool.yaml
name: mytool
binds:
- { source: "~/.config/mytool", mode: rw, optional: true }
Development
uv run pytest
uv run ruff check src tests
uv run black src tests
Status
This is a personal project for my own needs. Use at your own risk. Issues and PRs welcome.
Release files for hozo 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hozo-0.2.0.tar.gz | 48.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hozo-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 78.0 kB
Release files / hozo-0.2.0.tar.gz
| Download URL | hozo-0.2.0.tar.gz |
|---|---|
| Size | 48.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a75ddaefb117ccd4f40d8d9f8d1f1c6ae817d4efddae0f3c6055034f66046cd6
|
|
BLAKE2b-256 checksum How to use checksums |
ea2adce5d009b7cdae4a191d69d7b299c851e8e72de72dc281f79b3452264ea3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.
Transparency logRelease files / hozo-0.2.0-py3-none-any.whl
| Download URL | hozo-0.2.0-py3-none-any.whl |
|---|---|
| Size | 29.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c878adeaf5af601bf718e3b574b303430facc0116de1cded0a21837a8c5c03bb
|
|
BLAKE2b-256 checksum How to use checksums |
78e24ac356089ef43ac27accf56600ff5aa4f808d06718377e1cd7cd8101a8c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.
Transparency log