1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: CI
on:
push:
branches:
pull_request:
branches:
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: test / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Format check
run: cargo fmt --all -- --check
# Blocking since v0.16. It was advisory "until it passes green", and it
# has now passed green on three platforms across ten merges - but the
# reason to flip it is sharper than that: clippy VERSIONS DIFFER between
# a developer machine and CI, and an advisory warning is only caught if
# someone reads the scrollback. A `format_in_format_args` lint fired on
# Windows clippy 1.96 and not on the newer toolchain the change was
# written against; it reached a pushed branch because nothing failed.
- name: Clippy
run: cargo clippy --all-targets -- -D warnings
- name: Test
run: cargo test --all
- name: Build release
run: cargo build --release
- name: Smoke test (the gate actually gates)
shell: bash
run: |
cd "$(mktemp -d)"
BIN="$GITHUB_WORKSPACE/target/release/termaxa"
"$BIN" init
# a benign command is allowed
"$BIN" check "git status"
# the trench-coat bypass is denied (exit 4)
set +e
"$BIN" check "git status && rm -rf /"
code=$?
set -e
if [ "$code" != "4" ]; then
echo "expected deny (exit 4) for compound destructive command, got $code"
exit 1
fi
echo "smoke test passed: benign allowed, destructive denied"
# The privilege boundary, proved by a second real user.
#
# Unit tests cannot prove a boundary: every test in the Rust suite runs as
# one user, so "the agent cannot write the policy" is an assertion about code
# paths. This job creates a real account and has it TRY, asserting each
# attempt fails at the OS.
#
# BLOCKING as of this commit: the rig is 18/18. It was continue-on-error
# while two assertions failed for a real reason, on the argument that
# blocking every PR on a known gap means fixing it under time pressure or
# deleting the assertion. The gap is fixed, so the exemption goes with it -
# an allowance that outlives its reason is how a rig becomes decorative.
musl:
name: linux asset (musl, static)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- uses: Swatinem/rust-cache@v2
- name: musl toolchain
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Build the asset the release ships
run: cargo build --release --target x86_64-unknown-linux-musl
- name: It is static and it runs
run: |
file target/x86_64-unknown-linux-musl/release/termaxa | grep -q static
target/x86_64-unknown-linux-musl/release/termaxa --version
boundary:
name: privilege boundary (second real user)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build
- name: Run the boundary rig
run: sudo bash tests/boundary/rig.sh "$PWD/target/debug/termaxa"