Macos sandbox testing
Skill zhutao100/macos-sandbox-testing-skill/macos-sandbox-testing
In-process macOS Seatbelt sandbox/tripwire safety boundary for local dev/test commands (SwiftPM, Xcode/xcodebuild, Cargo, Go, Node, Python venv), so direct invocations like `swift test`, `xcodebuild test`, or `cargo test` cannot accidentally write outside the repo workspace. Installs a Seatbelt (`sandbox_init_with_parameters`) write guard plus optional filesystem/network mutation logging into supported executables and test runners.From its SKILL.md
npx -y skills add zhutao100/macos-sandbox-testing-skill --skill macos-sandbox-testingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its file declares
Copied from the file, not written here
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
4.0 KB, 750 tokens by cl100k_base, as published. Nobody here has run it
Objective
Ensure that direct invocations of local dev/test commands (for example swift test, xcodebuild test, cargo test, go test, npm test) cannot destructively mutate host-machine data outside the repo workspace (and, by default, cannot perform outbound IP networking), without relying on wrapper scripts.
What it does (high level)
When linked into a supported executable/test runner, the injected bootstrap:
- Creates a repo-local sandbox root under
<workspace>/.build/macos-sandbox-testing/<run-id>/. - Optionally redirects
HOME/TMPDIRinto that sandbox root. - Applies a kernel-enforced Seatbelt sandbox (SBPL) to deny out-of-workspace writes and (by default) deny IP networking.
- Optionally installs a tripwire logger (dyld interposing) that records out-of-bounds filesystem/network attempts into
logs/events.jsonl.
Supported integrations (pick one)
These are “works well, no-wrapper” integrations where the sandbox is compiled into the process that runs your code/tests:
- SwiftPM (Swift):
scripts/swiftpm_install.py/scripts/swiftpm_verify.py/scripts/swiftpm_uninstall.py→references/swiftpm.md - Xcode (
xcodebuild/ Xcode Product → Test):scripts/xcode_prepare.py(+ add files to target membership) →references/xcode.md - Rust / Cargo:
scripts/cargo_install.py/scripts/cargo_verify.py/scripts/cargo_uninstall.py→references/cargo.md - Go:
scripts/go_install.py/scripts/go_verify.py/scripts/go_uninstall.py→references/go.md - Node / TypeScript:
scripts/node_install.py/scripts/node_verify.py/scripts/node_uninstall.py→references/node.md - Python (venv):
scripts/python_install.py/scripts/python_verify.py/scripts/python_uninstall.py→references/python.md
Quick start
- Open the doc for your toolchain above and run its installer script.
- Run the verifier script (recommended) or run your tests with
SEATBELT_SANDBOX_SELFTEST=1. - Commit the injected files/patches into the target repo so direct invocations stay guarded.
When to use
Use when the user needs an in-process macOS sandbox (“Seatbelt”) boundary for local dev/test commands and wants to prevent accidental host mutations.
Do not use when:
- the target environment is not macOS, or
- the user needs a supported App Sandbox / entitlements solution for shipping binaries (different workflow).
Configuration
See references/configuration.md for the full set of runtime knobs. Common starters:
SEATBELT_SANDBOX_WORKSPACE_ROOT=/abs/path(orSANDBOX_WORKSPACE_ROOT=/abs/path)SEATBELT_SANDBOX_SELFTEST=1SEATBELT_SANDBOX_NETWORK=deny|localhost|allow|allowlist
Troubleshooting / deeper background
references/debugging.mdreferences/design.mdreferences/other_languages.md(porting notes beyond first-class integrations)references/interpreted-and-vm-ecosystems.md(Node/Python bootstrapping tradeoffs)references/swiftpm-mixed-language-and-bootstrap.md(SwiftPM-specific background)
What ships with it: 55 files
429.2 KB alongside SKILL.md, 19 of them executable
assets/
- templates/go/bootstrap.go322 B
- templates/go/README.md970 B
- templates/go/SandboxTestingBootstrap.c53.1 KB
- templates/go/zz_macos_sandbox_testing_bootstrap_test.go294 B
- templates/node-typescript/binding.gyp236 B
- templates/node-typescript/package.json332 B
- templates/node-typescript/README.md1.1 KB
- templates/node-typescript/sandbox/addon.c351 B
- templates/node-typescript/sandbox/preload.jsruns466 B
- templates/node-typescript/sandbox/SandboxTestingBootstrap.c53.1 KB
- templates/python-venv/macos_sandbox_testing_bootstrap.pyruns604 B
- templates/python-venv/macos_sandbox_testing.pth39 B
- templates/python-venv/README.md1.2 KB
- templates/rust-cargo/build.rs1.2 KB
- templates/rust-cargo/Cargo.toml252 B
- templates/rust-cargo/README.md1.3 KB
- templates/rust-cargo/SandboxTestingBootstrap.c53.1 KB
- templates/rust-cargo/src/lib.rs928 B
- templates/SandboxTestingBootstrap.c53.1 KB
- templates/swiftpm/SandboxTestingBootstrap.c53.1 KB
- templates/swiftpm/SwiftPMSandboxTestingAnchor.swift408 B
- templates/swiftpm/SwiftPMSandboxTestingBootstrap.h528 B
- templates/xcode/README.md1.8 KB
- templates/xcode/SandboxTestingAnchor.c491 B
- templates/xcode/SandboxTestingAnchor.swift871 B
references/
- cargo.md1.0 KB
- configuration.md3.9 KB
- debugging.md9.4 KB
- design.md8.7 KB
- go.md1.0 KB
- interpreted-and-vm-ecosystems.md5.5 KB
- node.md1.1 KB
- other_languages.md4.6 KB
- python.md1.1 KB
- swiftpm.md1.4 KB
- swiftpm-mixed-language-and-bootstrap.md3.0 KB
- xcode.md5.2 KB
scripts/
- cargo_install.pyruns12.5 KB
- cargo_uninstall.pyruns7.8 KB
15 more files not listed here. See all 55 in the repository.