- Go 99.4%
- Just 0.6%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .just | ||
| .woodpecker | ||
| docs | ||
| e2e | ||
| internal | ||
| .gitignore | ||
| CHANGELOG.md | ||
| check.go | ||
| go.mod | ||
| go.sum | ||
| justfile | ||
| main.go | ||
| policy.go | ||
| README.md | ||
| run.go | ||
brig
Runs one command with what it needs, and nothing else of yours. Its secrets are delivered so that it holds as little of them as the tool allows; and when you think a command is iffy, it runs in a sandbox that exists only for it, driven by a policy that says what the command needs.
Status: being built. The policies, the plan, brig check, the Linux sandbox
with its proxy and ports, and keys injected — by proxy or gh's socket, into a
sandboxed run or a direct one, from locker's cred brig — are in. A run
that needs what is not built yet — a key by file, an ssh agent, macOS — is
refused, with exit 125.
The design is docs/design.md.
Usage
brig -- npm ci # npm's policy: its outputs, the registry, its token injected
brig -- npm publish # npm.publish's: still sandboxed, PUT allowed
brig -p 5173 -- npm run dev # and a port it may serve
brig -n api.example.com -- ./fetch.sh
brig -d -- gh pr list # direct: no sandbox, the token injected
brig --dry-run -- npm ci # what it would do (--json)
brig policy npm publish # a policy in force
brig check # prove the sandbox on this machine
Everything after the command word, or after --, is the command's. A
command named like one of brig's own (check, policy, version) runs
after --.
Exit status
The command's own, or 128 plus the signal that ended it. brig's own, as
env(1) has them:
| Status | Meaning |
|---|---|
| 125 | brig would not, or could not, run the command as asked — a refusal, a policy that does not read, a sandbox it cannot make — with a line saying why |
| 127 | the command was not found |
| 2 | brig was called wrong: a bad flag, no command |
Proving the sandbox
Two suites, each one command, run on the host from a plain terminal — not inside claudia, where no sandbox can be made:
brig check # every probe, directly and under brig
go test -tags e2e ./e2e # a built brig, run as you would
brig check runs each probe directly first, where it must get through — so
a probe that cannot see what it aims at here is skipped, not passed — and
then under brig, where it must be refused. Controls must get through under
brig too, so a sandbox that refuses everything cannot pass. The probes are
the same on every platform, one that does not apply being n/a, so two
machines compare line by line:
brig check --json > nikki.json # on Linux
brig check --against nikki.json # on the Mac: where the two differ
Unit tests, go test ./..., cover every decision that is not a syscall, and
run anywhere.