interplane-forge
INTERPLANE Forge
Brought by drakestapleton
interplane-forge / infra / test / sandbox.sh
| 1 | #!/usr/bin/env bash |
| 2 | # Private regression and isolation evidence. No live data, ports or processes. |
| 3 | set -euo pipefail |
| 4 | cd "$(dirname "$0")/../.." |
| 5 | ROOT=$PWD |
| 6 | # The pool this run takes turns on, and the cores in it it runs on (default pool 12-14, cores 12,13; |
| 7 | # a bay in another pool sets SANDBOX_POOL and FORGED_CPUS, ticket t_945ca0ae). |
| 8 | SANDBOX_POOL=${SANDBOX_POOL:-12-14} |
| 9 | if [[ ${FORGED_SANDBOX_LOCKED:-0} != 1 ]]; then |
| 10 | cpus=${FORGED_CPUS:-12,13} |
| 11 | exec env FORGED_SANDBOX_LOCKED=1 FORGED_CPUS="$cpus" \ |
| 12 | flock -o "$HOME/handoffs/hive/queen/pool-$SANDBOX_POOL.lock" \ |
| 13 | taskset -c "$cpus" nice -n 10 bash "$0" "$@" |
| 14 | fi |
| 15 | # The cores this run may use (the lock above; an operator fallback sets FORGED_CPUS itself). |
| 16 | CPUS=${FORGED_CPUS:-12,13} |
| 17 | OUT=${SANDBOX_EVIDENCE:-$(dirname "$ROOT")/sandbox-evidence} |
| 18 | OUT=$(realpath -m "$OUT") |
| 19 | mkdir -p "$OUT" |
| 20 | T=$(mktemp -d "$OUT/run.XXXXXX") |
| 21 | printf '%s\n' "$T" > "$OUT/latest" |
| 22 | # Private ports: PORT for forged, PORT+4 and PORT+5 for sandbox-netns.sh (SANDBOX_PORT overrides). |
| 23 | PORT=${SANDBOX_PORT:-19830} |
| 24 | PID= |
| 25 | stop() { |
| 26 | if [[ -n $PID ]]; then |
| 27 | kill -- "-$PID" 2>/dev/null || true |
| 28 | wait "$PID" 2>/dev/null || true |
| 29 | PID= |
| 30 | for i in $(seq 1 50); do |
| 31 | [[ -z $(ss -ltnH "sport = :$PORT") ]] && return 0 |
| 32 | sleep .1 |
| 33 | done |
| 34 | echo "FAIL private port $PORT remained open after shutdown" >&2 |
| 35 | return 1 |
| 36 | fi |
| 37 | } |
| 38 | trap stop EXIT |
| 39 | # port_free: succeed once nothing listens on $PORT; wait up to 10 s (0.1 s steps) for the listener of |
| 40 | # the step before to finish closing (its process group is killed, the kernel closes the socket a |
| 41 | # moment later, longer on a loaded host). A listener that stays fails exactly as before. |
| 42 | port_free() { |
| 43 | local i |
| 44 | for i in $(seq 1 100); do |
| 45 | [[ -z $(ss -ltnH "sport = :$PORT") ]] && return 0 |
| 46 | sleep .1 |
| 47 | done |
| 48 | return 1 |
| 49 | } |
| 50 | record() { |
| 51 | local name=$1 rc; shift |
| 52 | printf '%q ' "$@" > "$T/$name.command"; echo >> "$T/$name.command" |
| 53 | if "$@" > "$T/$name.log" 2>&1; then rc=0; else rc=$?; fi |
| 54 | printf '%s\n' "$rc" > "$T/$name.exit" |
| 55 | sha256sum "$T/$name.log" >> "$T/SHA256SUMS" |
| 56 | echo "$name exit=$rc log=$T/$name.log" |
| 57 | return "$rc" |
| 58 | } |
| 59 | [[ -z $(ss -ltnH "sport = :$PORT") ]] || { echo "BLOCKED port $PORT occupied"; exit 3; } |
| 60 | record bwrap /usr/bin/bwrap --ro-bind / / true |
| 61 | record host-packages dpkg-query -W bubblewrap util-linux bash coreutils mawk libc6 git openssh-client dash gzip |
| 62 | record host-binaries sha256sum /usr/bin/bwrap /usr/bin/setpriv /usr/bin/git /usr/bin/ssh-keygen /usr/bin/dash /usr/bin/gzip |
| 63 | record candidate-files sha256sum infra/spark/forged-sandbox.sh infra/spark/forged-service.sh infra/spark/forged-public.sh infra/spark/forged-counts.sh infra/spark/forged-listen.om infra/spark/forged-seccomp.om server/main.om server/count-snapshot.om infra/spark/public-read.om infra/test/sandbox.sh infra/spark/interplane-forged.service infra/spark/interplane-forged-tunnel.service infra/spark/forged-tunnel.sh infra/test/sandbox-hardening.sh infra/test/sandbox-netns.sh infra/test/sandbox-community.sh infra/test/envprobe.om infra/test/hog.om infra/test/netprobe.om infra/test/leakprobe.c infra/test/restart-hold.py infra/test/seccomp-order.py infra/test/seccomp-table.py infra/test/listener-poison.py infra/test/sandbox-refresh.py infra/test/sandbox-integrated.py infra/test/count-snapshot.py run.sh infra/smoke.sh dl/tests/http-check.sh |
| 64 | H=$T/home |
| 65 | DATA=$H/forge-data |
| 66 | RID=z631r2JJiVT8it4tST7RK24hpowi |
| 67 | mkdir -p "$H/handoffs/radicle" "$H/.radicle/storage" "$T/source" "$T/http" |
| 68 | mkdir -m 700 "$DATA" |
| 69 | mkdir -p "$DATA/logs" |
| 70 | printf 'private direct-launch fixture\n' > "$DATA/forged-supervisor.pid" |
| 71 | mkdir -p "$H/.ssh" "$H/services/vaultwarden/data" "$H/.local/share/atlas-vault" |
| 72 | mkdir -p "$H/.local/state/aien-factory" |
| 73 | # Deliberately future-dated fixture: nsage clamps to zero, so exact JSON bytes |
| 74 | # can be compared across runs without changing or mocking the server's clock. |
| 75 | printf '2\n9999999999\nz6MkfZDue1TbaNFi3ZzcD9uiTeduPLC52ucdFVuLKZwexxhK\n2\n%s 2 1 0 0 0\n' "$RID" \ |
| 76 | > "$H/.local/state/aien-factory/nodes.txt" |
| 77 | for f in "$H/.ssh/canary" "$H/handoffs/canary" "$H/services/vaultwarden/data/canary" "$H/.local/share/atlas-vault/canary"; do |
| 78 | printf 'sandbox-test-only\n' > "$f" |
| 79 | done |
| 80 | cat > "$H/handoffs/radicle/RIDS.md" <<EOF |
| 81 | | repo | RID | default branch | head sha | source dir | UTC | |
| 82 | |---|---|---|---|---|---| |
| 83 | | cuda-crack | rad:$RID | main | - | - | - | |
| 84 | EOF |
| 85 | git -C "$T/source" init -q -b main |
| 86 | for n in first second third fourth; do |
| 87 | printf '# Sandbox fixture\n%s\n' "$n" > "$T/source/README.md" |
| 88 | git -C "$T/source" add README.md |
| 89 | git -C "$T/source" -c user.name='Drake Stapleton' \ |
| 90 | -c user.email=213298340+drakestapleton@users.noreply.github.com commit -qm "fixture $n" |
| 91 | done |
| 92 | git clone -q --bare --no-hardlinks "$T/source" "$H/.radicle/storage/$RID" |
| 93 | # SANDBOX_STORE=1 (with IPL_DIR): the store-reading build. The fixture becomes a store at |
| 94 | # $H/interplane-store (store/tests/fixstore.sh); the binary is built for /home/drakestapleton/ |
| 95 | # interplane-store (rewritten to $H below, as every home path), serves every public line of that |
| 96 | # catalog less the deny list, and the wrapper binds the store read-only (FORGED_STORE) with only the |
| 97 | # served projects in ROOT/projects. Beside cuda-crack the store gets what the sandbox must not show |
| 98 | # (store-binds below): a private project, a public one under a denied name, a public one whose old id |
| 99 | # is the denied rad:z2ft64..., a staging/ and a repo.git.migration/ in cuda-crack, import-notes/, |
| 100 | # import.tsv and IMPORT-RECEIPT.txt, each holding a canary. |
| 101 | if [[ ${SANDBOX_STORE:-0} = 1 ]]; then |
| 102 | FIXSTORE_FROM=/nonexistent bash store/tests/fixstore.sh "$H/handoffs/radicle/RIDS.md" "$H/.radicle/storage" "$H/interplane-store" || |
| 103 | { echo 'BLOCKED fixture store'; exit 3; } |
| 104 | S=$H/interplane-store |
| 105 | sbproj() { # sbproj NAME VISIBILITY ALIAS: one more project in the fixture store, signed with fixstore's key |
| 106 | git clone -q --bare --no-hardlinks "$T/source" "$S/projects/$1/repo.git" && |
| 107 | "${IPL_DIR:?}/ipl" init "$S" "$1" main "$2" "$3" "$S/.fixkey" > /dev/null && |
| 108 | echo "$1" > "$T/sb.ev" && "$IPL_DIR/ipl" import "$S" "$1" main "$T/sb.ev" "$T/sb.ev" "fix-$1" "$S/.fixkey" > /dev/null |
| 109 | } |
| 110 | sbproj sbpriv private rad:zSandboxPrivateFixtureAAA1 && sbproj omega-pearl public rad:zSandboxDenyByNameAAAAAA1 && |
| 111 | sbproj sbalias public rad:z2ft64NFLsKzWttCXw6NWNbRQLggQ || { echo 'BLOCKED fixture store extras'; exit 3; } |
| 112 | mkdir -p "$S/projects/cuda-crack/staging" "$S/projects/cuda-crack/repo.git.migration" "$S/import-notes" |
| 113 | for f in projects/cuda-crack/staging/canary projects/cuda-crack/repo.git.migration/canary import-notes/canary import.tsv IMPORT-RECEIPT.txt; do |
| 114 | printf 'sandbox-test-only canary\n' > "$S/$f" |
| 115 | done |
| 116 | [[ $(awk -F'\t' '$5 == "public"' "$S/catalog.tsv" | wc -l) = 3 && $(awk -F'\t' '$5 == "private"' "$S/catalog.tsv" | wc -l) = 1 ]] || |
| 117 | { echo "BLOCKED fixture store catalog: $(cut -f1,5 "$S/catalog.tsv" | tr '\n\t' '; ')"; exit 3; } |
| 118 | export FORGE_STORE=/home/drakestapleton/interplane-store |
| 119 | echo "SANDBOX_STORE: store-reading build, store $H/interplane-store" |
| 120 | fi |
| 121 | OMC=$HOME/work/flux/omega-mv/seed/out/omc |
| 122 | PIN=3ad9f10f64309e7acf8a725082b28e23a2a4aeb07e98322fb4dc0fcd8fc93194 |
| 123 | [[ $(sha256sum "$OMC" | cut -d' ' -f1) = "$PIN" ]] || { echo 'BLOCKED compiler pin mismatch'; exit 3; } |
| 124 | # Only the private composed copy changes its home paths and listener. |
| 125 | { printf 'om2\n'; while read -r u; do cat "$u"; done < <(./run.sh units); } | |
| 126 | sed -e "s|/home/drakestapleton/|$H/|g" \ |
| 127 | -e "s|haddr4 a 2130706433 18480|haddr4 a 2130706433 $PORT|" \ |
| 128 | -e "s|^text tfzp0 .*|text tfzp0 \"$H/count-inputs/dl.log\"|" \ |
| 129 | -e "s|^text tfzp1 .*|text tfzp1 \"$H/count-inputs/access.log\"|" \ |
| 130 | -e "s|^text tfzwal .*|text tfzwal \"$H/count-inputs/wal\"|" \ |
| 131 | -e "s|^text tfzrad .*|text tfzrad \"$H/count-inputs/rad\"|" \ |
| 132 | -e "s|^text tfzgent .*|text tfzgent \"$H/count-inputs/getent\"|" > "$T/forged.om" |
| 133 | ! grep -q '/home/drakestapleton/forge-data\|haddr4 a 2130706433 18480' "$T/forged.om" |
| 134 | record build bash -c '"$1" < "$2" > "$3"' _ "$OMC" "$T/forged.om" "$T/forged" |
| 135 | chmod 755 "$T/forged" |
| 136 | record public-reader-build bash -c '"$1" < "$2" > "$3"' _ "$OMC" infra/spark/public-read.om "$T/public-read" |
| 137 | chmod 755 "$T/public-read" |
| 138 | sha256sum "$T/public-read" >> "$T/SHA256SUMS" |
| 139 | sha256sum "$OMC" "$T/forged.om" "$T/forged" >> "$T/SHA256SUMS" |
| 140 | source infra/test/sandbox-hardening.sh |
| 141 | record hardening-build hardening_build |
| 142 | source infra/test/sandbox-netns.sh |
| 143 | record netns-build netns_build |
| 144 | # The socket filter for host tools run in the sandbox here (git, ssh-keygen, dash, the probes |
| 145 | # outside T); forged and the probes in T find it beside themselves. |
| 146 | export FORGED_SECCOMP=$T/forged-seccomp.bpf |
| 147 | trap 'stop; private_listeners_stop; unit_cleanup' EXIT |
| 148 | export FORGED_READ_HOME=$H FORGED_PATH_HOME=$H FORGE_DATA=$DATA |
| 149 | [[ ${SANDBOX_STORE:-0} = 1 ]] && export FORGED_STORE=$H/interplane-store |
| 150 | WRAPPER=$ROOT/infra/spark/forged-sandbox.sh |
| 151 | export FORGED_PUBLIC_READER=$T/public-read FORGED_PUBLIC_DIR=$H/forge-public |
| 152 | export FORGED_PUBLIC_LIB=$ROOT/infra/spark/forged-public.sh |
| 153 | BIN=$T/forged |
| 154 | source "$FORGED_PUBLIC_LIB" |
| 155 | public_init |
| 156 | record mirror-initial public_sync |
| 157 | mirror_paths_check() { |
| 158 | local rc |
| 159 | rc=0; (FORGED_PUBLIC_DIR=$DATA/child-export public_init) || rc=$? |
| 160 | [[ $rc = 2 && ! -e $DATA/child-export ]] || return 1 |
| 161 | mkdir -p "$T/unrelated-export" |
| 162 | printf 'private canary\n' > "$T/unrelated-export/private" |
| 163 | rc=0; (FORGED_PUBLIC_DIR=$T/unrelated-export public_init) || rc=$? |
| 164 | [[ $rc = 2 && $(cat "$T/unrelated-export/private") = 'private canary' ]] || return 1 |
| 165 | ln -s "$PUBLIC" "$T/export-link" |
| 166 | rc=0; (FORGED_PUBLIC_DIR=$T/export-link public_init) || rc=$? |
| 167 | [[ $rc = 2 ]] || return 1 |
| 168 | source infra/spark/forged-counts.sh |
| 169 | rc=0; (FORGED_COUNTS_STATE=$DATA/count-state counts_init) || rc=$? |
| 170 | [[ $rc = 2 && ! -e $DATA/count-state ]] || return 1 |
| 171 | rc=0; (FORGED_COUNTS_STATE=$PUBLIC/count-state counts_init) || rc=$? |
| 172 | [[ $rc = 2 && ! -e $PUBLIC/count-state ]] || return 1 |
| 173 | rc=0; (FORGED_COUNTS_STATE=$T/export-link counts_init) || rc=$? |
| 174 | [[ $rc = 2 ]] || return 1 |
| 175 | echo 'PASS writable-data export, unrelated directory, export symlink and unsafe count-state refused' |
| 176 | } |
| 177 | record mirror-path-controls mirror_paths_check |
| 178 | mkdir -p "$H/handoffs/hive/manager/reviews" "$H/handoffs/hive/forge/receipts" |
| 179 | start() { |
| 180 | local mode=$1 |
| 181 | [[ -z $(ss -ltnH "sport = :$PORT") ]] || return 1 |
| 182 | if [[ $mode = baseline ]]; then |
| 183 | setsid strace -f -e trace=file,process,network -o "$T/strace.log" \ |
| 184 | "$T/forged" > "$T/baseline-server.log" 2>&1 & |
| 185 | else |
| 186 | FORGED_LISTEN_PORT=$PORT setsid bash "$WRAPPER" "$T/forged" > "$T/sandbox-server.log" 2>&1 & |
| 187 | fi |
| 188 | PID=$! |
| 189 | for i in $(seq 1 100); do |
| 190 | kill -0 "$PID" 2>/dev/null || { cat "$T/$mode-server.log"; return 1; } |
| 191 | if curl --max-time 1 -fsS "http://127.0.0.1:$PORT/" -o /dev/null; then return; fi |
| 192 | sleep .1 |
| 193 | done |
| 194 | return 1 |
| 195 | } |
| 196 | paths=(/ /explore /assets/forge.css /drakestapleton/cuda-crack |
| 197 | /drakestapleton/cuda-crack/blob/main/README.md |
| 198 | /drakestapleton/cuda-crack/raw/main/README.md |
| 199 | /drakestapleton/cuda-crack/archive/refs/heads/main.zip |
| 200 | /drakestapleton/cuda-crack/archive/refs/heads/main.tar.gz /status.json) |
| 201 | # the store-reading build has no node status page (server/nostat.om, 501); its door answers instead |
| 202 | [[ ${SANDBOX_STORE:-0} = 1 ]] && paths=("${paths[@]/\/status.json/\/agents.json}" /events.json /feed) |
| 203 | fetch() { |
| 204 | local mode=$1 i=0 p code |
| 205 | for p in "${paths[@]}"; do |
| 206 | code=$(curl --max-time 30 -sS -o "$T/http/$mode.$i" -w '%{http_code}' "http://127.0.0.1:$PORT$p") |
| 207 | [[ $code = 200 ]] || { echo "FAIL $p status=$code"; return 1; } |
| 208 | if [[ $mode = sandbox ]]; then cmp "$T/http/baseline.$i" "$T/http/sandbox.$i" || return 1; fi |
| 209 | echo "PASS $p status=$code${mode/sandbox/ byte cmp}" |
| 210 | i=$((i+1)) |
| 211 | done |
| 212 | } |
| 213 | record baseline-start start baseline |
| 214 | record baseline-http fetch baseline |
| 215 | stop |
| 216 | sha256sum "$T/strace.log" "$T/baseline-server.log" >> "$T/SHA256SUMS" |
| 217 | # Repeat from cold caches. The same repository and service data remain in place. |
| 218 | rm -rf "$DATA/archives" "$DATA/collab" "$DATA/search" |
| 219 | touch "$T/umask-marker" |
| 220 | sleep 1 |
| 221 | record sandbox-start start sandbox |
| 222 | record parity fetch sandbox |
| 223 | record smoke env FORGE_SMOKE_PORT=$PORT FORGE_TEST_PORT=$PORT bash infra/smoke.sh local |
| 224 | record downloads env FORGE_TEST_STORAGE="$H/.radicle/storage" FORGE_TEST_EVIDENCE="$T/http" \ |
| 225 | bash dl/tests/http-check.sh "$PORT" |
| 226 | stop |
| 227 | sha256sum "$T/sandbox-server.log" >> "$T/SHA256SUMS" |
| 228 | record limits-load load_check |
| 229 | record umask umask_check "$T/umask-marker" |
| 230 | # Every community route through the sandboxed forged, with the live store's shapes and a mutant |
| 231 | # (infra/test/sandbox-community.sh says why). Before the supervisor checks, so a red supervisor |
| 232 | # check cannot hide it. |
| 233 | source infra/test/sandbox-community.sh |
| 234 | if [[ ${SANDBOX_STORE:-0} = 1 ]]; then |
| 235 | # the store-reading build composes salvage/ and community/ out (their seams): it has no community |
| 236 | # routes to walk. The wrapper's community mounts are still checked below (community-store and on). |
| 237 | echo 'NOT_APPLICABLE community-routes, community-routes-mutant: salvage/ and community/ are not composed in the store-reading build' |
| 238 | else |
| 239 | record community-routes community_routes_check |
| 240 | record community-routes-mutant community_routes_mutant |
| 241 | fi |
| 242 | rm -rf "$DATA/community" "$DATA/salvage" "$CMR_PUB" |
| 243 | reload_check() { |
| 244 | # Invoke the actual supervisor function without starting any tmux session. |
| 245 | source <(sed -n '/^flag_file() {/,/^}/p; /^reload_flag() /p' infra/spark/forged-service.sh) || return 1 |
| 246 | declare -F flag_file reload_flag || return 1 |
| 247 | printf 'outside service data\n' > "$T/reload-canary" || return 1 |
| 248 | touch -t 200001010000 "$T/reload-canary" || return 1 |
| 249 | local before after |
| 250 | before=$(stat -c '%Y %s' "$T/reload-canary") |
| 251 | ln -s "$T/reload-canary" "$DATA/reload" || return 1 |
| 252 | reload_flag || return 1 |
| 253 | after=$(stat -c '%Y %s' "$T/reload-canary") |
| 254 | [[ $before = "$after" && -f $DATA/reload && ! -L $DATA/reload ]] || return 1 |
| 255 | rm "$DATA/reload" || return 1 |
| 256 | echo 'PASS supervisor reload does not follow a child-planted symlink' |
| 257 | } |
| 258 | record reload-control reload_check |
| 259 | supervisor_check() { |
| 260 | FORGED_BIN=$T/forged FORGED_PORT=$PORT FORGED_CPUS=$CPUS \ |
| 261 | setsid bash infra/spark/forged-service.sh _loop > "$T/supervisor-process.log" 2>&1 & |
| 262 | PID=$! |
| 263 | local ready=0 |
| 264 | for i in $(seq 1 100); do |
| 265 | if curl --max-time 1 -fsS "http://127.0.0.1:$PORT/" -o /dev/null; then ready=1; break; fi |
| 266 | kill -0 "$PID" 2>/dev/null || return 1 |
| 267 | sleep .1 |
| 268 | done |
| 269 | [[ $ready = 1 ]] || return 1 |
| 270 | grep -q 'forged-sandbox: on' "$DATA/logs/forged.log" || return 1 |
| 271 | [[ $(cat "$DATA/forged-supervisor.pid") = "$PID" ]] || return 1 |
| 272 | kill -HUP "$PID" || return 1 |
| 273 | # HUP handling is asynchronous; wait for the supervisor acknowledgment. |
| 274 | for i in $(seq 1 50); do |
| 275 | grep -q 'SIGHUP -> reload flag' "$DATA/logs/forged.log" && break |
| 276 | kill -0 "$PID" 2>/dev/null || return 1 |
| 277 | sleep .05 |
| 278 | done |
| 279 | grep -q 'SIGHUP -> reload flag' "$DATA/logs/forged.log" || return 1 |
| 280 | curl --max-time 10 -fsS "http://127.0.0.1:$PORT/" -o /dev/null || return 1 |
| 281 | grep -q 'SIGHUP -> reload flag' "$DATA/logs/forged.log" || return 1 |
| 282 | stop || return 1 |
| 283 | echo 'PASS private supervisor launched sandbox, served HTTP, accepted reload and stopped' |
| 284 | } |
| 285 | record supervisor supervisor_check |
| 286 | cp "$DATA/logs/forged.log" "$T/supervisor-service.log" |
| 287 | sha256sum "$T/supervisor-process.log" "$T/supervisor-service.log" >> "$T/SHA256SUMS" |
| 288 | record service-env service_env_check infra/spark new |
| 289 | old_service_dir |
| 290 | if record service-env-old service_env_check "$T/oldsvc" old; then |
| 291 | echo 'FAIL the r4 start kept no starter variable (the control has no teeth)'; exit 1 |
| 292 | fi |
| 293 | grep -q '^LEAK pid' "$T/service-env-old.log" |
| 294 | record log-fsize log_fsize_check infra/spark new keeps |
| 295 | # Control: the r4 supervisor gives forged the log file itself; its writes past 1 GiB end in SIGXFSZ. |
| 296 | record log-fsize-old log_fsize_check "$T/oldsvc" old dies |
| 297 | mkdir -p "$T/bad-data" "$T/outside-logs" |
| 298 | ln -s "$T/outside-logs" "$T/bad-data/logs" |
| 299 | if record supervisor-symlink env FORGE_DATA="$T/bad-data" FORGED_CPUS=$CPUS \ |
| 300 | bash infra/spark/forged-service.sh _loop; then |
| 301 | echo 'FAIL supervisor accepted a symlinked log directory'; exit 1 |
| 302 | fi |
| 303 | [[ $(cat "$T/supervisor-symlink.exit") = 2 && ! -e $T/outside-logs/forged.log ]] |
| 304 | |
| 305 | mkdir -p "$H/forge-counts-state" |
| 306 | printf 'owner-only journal canary\n' > "$H/forge-counts-state/counts.log" |
| 307 | cat > "$T/probe" <<'PROBE' |
| 308 | #!/bin/sh |
| 309 | set -eu |
| 310 | home=$1 |
| 311 | hosthome=$2 |
| 312 | fail=0 |
| 313 | deny_read() { |
| 314 | if (exec 3< "$1") 2>/dev/null; then echo "FAIL readable $1"; fail=1 |
| 315 | else echo "PASS denied read $1"; fi |
| 316 | } |
| 317 | for p in "$home/.ssh/canary" "$home/handoffs/canary" \ |
| 318 | "$home/services/vaultwarden/data/canary" "$home/.local/share/atlas-vault/canary" \ |
| 319 | "$home/forge-counts-state/counts.log" \ |
| 320 | "$hosthome/.ssh" "$hosthome/.radicle/keys" "$hosthome/services/vaultwarden/data" \ |
| 321 | "/proc/1/root$hosthome/.ssh" /etc/shadow; do deny_read "$p"; done |
| 322 | if [ -r "$home/handoffs" ]; then echo 'FAIL handoffs listable'; fail=1; else echo 'PASS handoffs hidden'; fi |
| 323 | if sudo -n true 2>/dev/null; then echo 'FAIL sudo'; fail=1; else echo 'PASS sudo denied'; fi |
| 324 | for p in /escape /app/escape /tmp/escape "$home/escape" "$home/.radicle/storage/z631r2JJiVT8it4tST7RK24hpowi/config" \ |
| 325 | "$home/forge-data/logs/escape" "$home/forge-data/forged-supervisor.pid" \ |
| 326 | "$home/handoffs/radicle/RIDS.md" "$home/.local/state/aien-factory/nodes.txt" \ |
| 327 | "$home/handoffs/radicle/counts.snapshot" \ |
| 328 | "$home/handoffs/hive/manager/reviews/child.verdict.txt" "$home/handoffs/hive/forge/receipts/child.receipt.txt" \ |
| 329 | "$home/forge-public/RIDS.md" "$home/interplane-store/catalog.tsv" \ |
| 330 | "$home/interplane-store/projects/cuda-crack/repo.git/config" "$home/interplane-store/projects/cuda-crack/chain.tsv"; do |
| 331 | if (printf x >> "$p") 2>/dev/null; then echo "FAIL write $p"; fail=1; else echo "PASS denied write $p"; fi |
| 332 | done |
| 333 | printf ok > "$home/forge-data/probe-write" |
| 334 | echo 'PASS data writable' |
| 335 | nnp=0 |
| 336 | caps=missing |
| 337 | while read -r key value rest; do |
| 338 | if [ "$key" = NoNewPrivs: ]; then nnp=$value; fi |
| 339 | if [ "$key" = CapEff: ]; then caps=$value; fi |
| 340 | done < /proc/self/status |
| 341 | [ "$nnp" = 1 ] || fail=1 |
| 342 | [ "$caps" = 0000000000000000 ] || fail=1 |
| 343 | echo "NoNewPrivs: $nnp" |
| 344 | echo "CapEff: $caps" |
| 345 | exit "$fail" |
| 346 | PROBE |
| 347 | chmod 755 "$T/probe" |
| 348 | record isolation bash "$WRAPPER" /usr/bin/dash -s -- "$H" "$HOME" < "$T/probe" |
| 349 | record no-new-privs bash "$WRAPPER" /usr/bin/grep NoNewPrivs /proc/self/status |
| 350 | grep -qE '^NoNewPrivs:[[:space:]]+1$' "$T/no-new-privs.log" |
| 351 | # store-binds (SANDBOX_STORE=1, review P2): from inside the sandbox the store root is whole but |
| 352 | # ROOT/projects holds only the served projects. Private, denied-name and denied-old-id projects are |
| 353 | # absent; a served project's staging/ and repo.git.migration/, import-notes/ are empty and read-only, |
| 354 | # import.tsv and IMPORT-RECEIPT.txt read as nothing; a served project's repo.git and records read. |
| 355 | # Control: a wrapper without the tmpfs over ROOT/projects must fail the same probe. Then (review P3) |
| 356 | # the store build starts with no RIDS.md: the mirror revokes its copy without stopping, and the |
| 357 | # wrapper starts. |
| 358 | if [[ ${SANDBOX_STORE:-0} = 1 ]]; then |
| 359 | cat > "$T/store-probe" <<'PROBE' |
| 360 | s=$1/interplane-store |
| 361 | fail=0 |
| 362 | absent() { if [ -e "$1" ]; then echo "FAIL present $1"; fail=1; else echo "PASS absent $1"; fi; } |
| 363 | empty() { if [ -s "$1" ]; then echo "FAIL not empty $1"; fail=1; else echo "PASS empty $1"; fi; } |
| 364 | readable() { if (exec 3< "$1") 2>/dev/null; then echo "PASS readable $1"; else echo "FAIL unreadable $1"; fail=1; fi; } |
| 365 | for p in sbpriv omega-pearl sbalias; do absent "$s/projects/$p"; done |
| 366 | for p in projects/cuda-crack/staging/canary projects/cuda-crack/repo.git.migration/canary import-notes/canary; do absent "$s/$p"; done |
| 367 | empty "$s/import.tsv"; empty "$s/IMPORT-RECEIPT.txt" |
| 368 | for p in catalog.tsv projects/cuda-crack/repo.git/HEAD projects/cuda-crack/repo.git/config projects/cuda-crack/records/1 projects/cuda-crack/chain.tsv; do readable "$s/$p"; done |
| 369 | read -r l < "$s/projects/cuda-crack/records/1" |
| 370 | if [ "$l" = "interplane-project 1" ]; then echo 'PASS served records/1 reads'; else echo "FAIL records/1 first line '$l'"; fail=1; fi |
| 371 | n=0; while read -r line; do n=$((n + 1)); done < "$s/catalog.tsv" |
| 372 | if [ "$n" = 4 ]; then echo 'PASS catalog.tsv whole (4 lines: the root is bound, not filtered)'; else echo "FAIL catalog.tsv $n lines"; fail=1; fi |
| 373 | for e in "$s"/projects/*; do |
| 374 | case ${e##*/} in cuda-crack) echo "PASS projects/ holds $e" ;; *) echo "FAIL projects/ holds $e"; fail=1 ;; esac |
| 375 | done |
| 376 | for p in projects/cuda-crack/staging/x projects/new import-notes/x; do |
| 377 | if (printf x > "$s/$p") 2>/dev/null; then echo "FAIL writable $s/$p"; fail=1; else echo "PASS denied write $s/$p"; fi |
| 378 | done |
| 379 | exit "$fail" |
| 380 | PROBE |
| 381 | record store-binds bash "$WRAPPER" /usr/bin/dash -s -- "$H" < "$T/store-probe" |
| 382 | [[ $(grep -c '^PASS' "$T/store-binds.log") = 19 && $(grep -c '^FAIL' "$T/store-binds.log") = 0 ]] || { echo 'FAIL store-binds: see store-binds.log'; exit 1; } |
| 383 | sed -e 's|^ args+=(--tmpfs "$store_at/projects")$| : control, no tmpfs over projects|' \ |
| 384 | -e 's|^ args+=(--remount-ro "$store_at/projects")$| : control|' "$WRAPPER" > "$T/wrapper-wholestore.sh" |
| 385 | bash -n "$T/wrapper-wholestore.sh" || { echo 'FAIL store-binds control: the mutant wrapper does not parse'; exit 1; } |
| 386 | if cmp -s "$WRAPPER" "$T/wrapper-wholestore.sh"; then echo 'FAIL store-binds control: the mutation did not apply'; exit 1; fi |
| 387 | if record store-binds-control bash "$T/wrapper-wholestore.sh" /usr/bin/dash -s -- "$H" < "$T/store-probe"; then |
| 388 | echo 'FAIL store-binds control: a wrapper binding all of projects/ passed the probe'; exit 1 |
| 389 | fi |
| 390 | grep -q '^FAIL present .*/projects/sbpriv$' "$T/store-binds-control.log" || { echo 'FAIL store-binds control: the mutant did not show sbpriv'; exit 1; } |
| 391 | echo 'PASS store-binds: only served projects in the sandbox, staging, migration, import notes masked; control caught' |
| 392 | mv "$H/handoffs/radicle/RIDS.md" "$T/RIDS.md.aside" |
| 393 | record store-no-rids-sync public_sync |
| 394 | [[ ! -e $FORGED_PUBLIC_DIR/RIDS.md ]] |
| 395 | record store-no-rids-start bash "$WRAPPER" /usr/bin/true |
| 396 | mv "$T/RIDS.md.aside" "$H/handoffs/radicle/RIDS.md" |
| 397 | record store-rids-back public_sync |
| 398 | [[ -f $FORGED_PUBLIC_DIR/RIDS.md ]] |
| 399 | echo 'PASS store build without RIDS.md: the mirror revokes its copy without stopping and the wrapper starts' |
| 400 | fi |
| 401 | # A canary in the starter's environment reaches no process the child can see. |
| 402 | record env-clean env FORGED_R5_CANARY="$CANARY" bash "$WRAPPER" "$T/envprobe" "$CANARY" |
| 403 | grep -q '^environ /proc/1/environ bytes 0 canary absent$' "$T/env-clean.log" |
| 404 | grep -q '^processes seen [2-9]' "$T/env-clean.log" |
| 405 | env_mutant |
| 406 | if record env-mutant env FORGED_R5_CANARY="$CANARY" bash "$T/env-mutant.sh" "$T/envprobe" "$CANARY"; then |
| 407 | echo 'FAIL the r4 final line kept no starter variable (the control has no teeth)'; exit 1 |
| 408 | fi |
| 409 | grep -q '^environ /proc/1/environ bytes [1-9][0-9]* canary PRESENT$' "$T/env-mutant.log" |
| 410 | record limits-values limit_values_check |
| 411 | record limits-fork fork_hog_check |
| 412 | record limits-memory mem_hog_check |
| 413 | record limits-file file_hog_check |
| 414 | record guards guard_check |
| 415 | # Exercise the real signature verifier with a throwaway key kept outside the profile. |
| 416 | ssh-keygen -q -t ed25519 -N '' -f "$T/signing-key" |
| 417 | printf 'sandbox signature fixture\n' > "$DATA/message" |
| 418 | printf 'fixture %s\n' "$(cat "$T/signing-key.pub")" > "$DATA/allowed" |
| 419 | ssh-keygen -Y sign -f "$T/signing-key" -n sandbox "$DATA/message" > "$T/sign.log" 2>&1 |
| 420 | record signature bash "$WRAPPER" /usr/bin/ssh-keygen -Y verify -f "$DATA/allowed" \ |
| 421 | -I fixture -n sandbox -s "$DATA/message.sig" < "$DATA/message" |
| 422 | printf 'changed message\n' > "$DATA/changed" |
| 423 | if record signature-negative bash "$WRAPPER" /usr/bin/ssh-keygen -Y verify -f "$DATA/allowed" \ |
| 424 | -I fixture -n sandbox -s "$DATA/message.sig" < "$DATA/changed"; then |
| 425 | echo 'FAIL invalid signature accepted'; exit 1 |
| 426 | fi |
| 427 | # Scratch-only mutation: remove read-only protection on the fixture repo (the store root in a |
| 428 | # store-reading build). |
| 429 | if [[ ${SANDBOX_STORE:-0} = 1 ]]; then |
| 430 | sed 's/args+=(--ro-bind "$store" "$store_at")/args+=(--bind "$store" "$store_at")/' "$WRAPPER" > "$T/mutant.sh" |
| 431 | grep -q 'args+=(--bind "$store" "$store_at")' "$T/mutant.sh" |
| 432 | else |
| 433 | sed 's/args+=(--ro-bind "$repo"/args+=(--bind "$repo"/' "$WRAPPER" > "$T/mutant.sh" |
| 434 | grep -q 'args+=(--bind "$repo"' "$T/mutant.sh" |
| 435 | fi |
| 436 | # the control writes into the scratch fixture when it is writable (that is what it shows): keep the |
| 437 | # store's files the probe appends to, and put them back after it, so the later steps read a whole store |
| 438 | SB=$T/store-before-mutation |
| 439 | if [[ ${SANDBOX_STORE:-0} = 1 ]]; then |
| 440 | mkdir -p "$SB"; cp -p "$H/interplane-store/catalog.tsv" "$H/interplane-store/projects/cuda-crack/repo.git/config" "$H/interplane-store/projects/cuda-crack/chain.tsv" "$SB/" |
| 441 | fi |
| 442 | if record mutation bash "$T/mutant.sh" /usr/bin/dash -s -- "$H" "$HOME" < "$T/probe"; then |
| 443 | echo 'FAIL mutation escaped the control'; exit 1 |
| 444 | fi |
| 445 | if [[ ${SANDBOX_STORE:-0} = 1 ]]; then |
| 446 | grep -q 'FAIL write .*interplane-store/' "$T/mutation.log" |
| 447 | echo 'PASS mutation: writable store caught by same probe' |
| 448 | cp -p "$SB/catalog.tsv" "$H/interplane-store/catalog.tsv"; cp -p "$SB/config" "$H/interplane-store/projects/cuda-crack/repo.git/config" |
| 449 | cp -p "$SB/chain.tsv" "$H/interplane-store/projects/cuda-crack/chain.tsv" |
| 450 | cmp -s "$SB/catalog.tsv" "$H/interplane-store/catalog.tsv" && cmp -s "$SB/chain.tsv" "$H/interplane-store/projects/cuda-crack/chain.tsv" |
| 451 | else |
| 452 | grep -q 'FAIL write .*storage.*/config' "$T/mutation.log" |
| 453 | echo 'PASS mutation: writable repository caught by same probe' |
| 454 | fi |
| 455 | record rollback env FORGED_SANDBOX=off bash "$WRAPPER" /usr/bin/true |
| 456 | grep -q 'OWNER ACCOUNT EXPOSED' "$T/rollback.log" |
| 457 | # The community hub (community/, docs/COMMUNITY.md): with salvage on and <data>/community/ present, |
| 458 | # the child gets its writable record store and, read-only at /community, the host folder |
| 459 | # <data>/../forge-community with dist/ (what volunteers download) and deny (the operator's list). |
| 460 | # The probe (dash builtins only: the sandbox has no other tools) writes the store and fails to |
| 461 | # write dist/ or deny; the served join.sh is unchanged. /community is a mount point directly under |
| 462 | # the read-only root, so it cannot be renamed; the hub reads dist/ and deny only from there (the |
| 463 | # community gate checks that a dist/join.sh planted in the store is not served). Control: a wrapper |
| 464 | # that binds the folder writable lets the same probe write join.sh. A link in place of deny stops |
| 465 | # the sandbox. |
| 466 | CPUB=$H/forge-community |
| 467 | mkdir -m 700 "$DATA/community" "$CPUB" "$CPUB/dist" |
| 468 | printf 'join\n' > "$CPUB/dist/join.sh"; : > "$CPUB/deny" |
| 469 | cat > "$T/community-probe" <<'CPROBE' |
| 470 | set -u |
| 471 | c=$INTERPLANE_COMMUNITY_DIR p=$INTERPLANE_COMMUNITY_PUB |
| 472 | echo "store: $c pub: $p" |
| 473 | [ "$p" = /community/ ] || exit 10 |
| 474 | echo x > "$c/probe-store" || exit 11 |
| 475 | if echo x >> "$p/dist/join.sh" 2> /dev/null; then echo 'WROTE dist/join.sh'; exit 12; fi |
| 476 | if echo 'key x' >> "$p/deny" 2> /dev/null; then echo 'WROTE deny'; exit 13; fi |
| 477 | if echo x > "$p/dist/new" 2> /dev/null; then echo 'WROTE dist/new'; exit 14; fi |
| 478 | read -r line < "$p/dist/join.sh" |
| 479 | [ "$line" = join ] || { echo 'SERVED FILE CHANGED'; exit 16; } |
| 480 | echo 'store writable; dist and deny read-only at /community' |
| 481 | CPROBE |
| 482 | record community-store env FORGED_SALVAGE=on bash "$WRAPPER" /usr/bin/dash -s < "$T/community-probe" |
| 483 | grep -q 'dist and deny read-only at /community' "$T/community-store.log" && [ "$(cat "$CPUB/dist/join.sh")" = join ] && [ ! -s "$CPUB/deny" ] && [ -s "$DATA/community/probe-store" ] |
| 484 | sed 's|--ro-bind "$cpub" /community)|--bind "$cpub" /community)|' "$WRAPPER" > "$T/mutant-community.sh" |
| 485 | grep -q -- '--bind "$cpub" /community)' "$T/mutant-community.sh" |
| 486 | if record community-mutant env FORGED_SALVAGE=on bash "$T/mutant-community.sh" /usr/bin/dash -s < "$T/community-probe"; then |
| 487 | echo 'FAIL community mutant was not caught'; exit 1 |
| 488 | fi |
| 489 | grep -q 'WROTE dist/join.sh' "$T/community-mutant.log" |
| 490 | printf 'join\n' > "$CPUB/dist/join.sh" |
| 491 | mv "$CPUB/deny" "$CPUB/deny.f"; ln -s deny.f "$CPUB/deny" |
| 492 | if record community-link env FORGED_SALVAGE=on bash "$WRAPPER" /usr/bin/true; then echo 'FAIL deny link accepted'; exit 1; fi |
| 493 | grep -q 'deny must be a file' "$T/community-link.log" |
| 494 | rm -f "$CPUB/deny"; mv "$CPUB/deny.f" "$CPUB/deny" |
| 495 | mkdir -m 700 "$DATA/inside-pub" "$DATA/inside-pub/dist"; : > "$DATA/inside-pub/deny" |
| 496 | if record community-inside env FORGED_SALVAGE=on FORGED_COMMUNITY_PUB="$DATA/inside-pub" bash "$WRAPPER" /usr/bin/true; then echo 'FAIL pub folder inside data accepted'; exit 1; fi |
| 497 | grep -q 'is inside the data folder' "$T/community-inside.log" |
| 498 | mkdir -m 700 "$H/dist"; : > "$H/deny" |
| 499 | if record community-holds env FORGED_SALVAGE=on FORGED_COMMUNITY_PUB="$H" bash "$WRAPPER" /usr/bin/true; then echo 'FAIL pub folder holding data accepted'; exit 1; fi |
| 500 | grep -q 'holds the data folder' "$T/community-holds.log" |
| 501 | rm -rf "$DATA/community" "$DATA/inside-pub" "$CPUB" "$H/dist" "$H/deny" |
| 502 | echo 'PASS community hub: writable store, read-only dist and deny at /community, mutant caught, link refused, pub folder inside or holding data refused' |
| 503 | # No network for the sandboxed server. |
| 504 | private_listeners |
| 505 | record netns-probe netns_probe_check |
| 506 | record netns-control netns_control |
| 507 | private_listeners_stop |
| 508 | record netns-listener netns_listener_check |
| 509 | record netns-refusal netns_refusal_check |
| 510 | record netns-off-service netns_off_service_check |
| 511 | record netns-trace netns_trace |
| 512 | # A compatibility check, not an expected security refusal. This must pass before |
| 513 | # release. Two FIFOs synchronize the replacement without clock-driven polling. |
| 514 | printf 'before verdict\n' > "$H/handoffs/hive/manager/reviews/refresh.verdict.txt" |
| 515 | printf 'before receipt\n' > "$H/handoffs/hive/forge/receipts/refresh.receipt.txt" |
| 516 | public_sync |
| 517 | cat > "$T/refresh-probe" <<'PROBE' |
| 518 | #!/bin/sh |
| 519 | set -eu |
| 520 | home=$1 |
| 521 | read -r before < "$home/handoffs/radicle/RIDS.md" |
| 522 | printf 'ready\n' > "$home/forge-data/ready" |
| 523 | read -r go < "$home/forge-data/go" |
| 524 | read -r after < "$home/handoffs/radicle/RIDS.md" |
| 525 | read -r nodes < "$home/.local/state/aien-factory/nodes.txt" |
| 526 | read -r verdict < "$home/handoffs/hive/manager/reviews/refresh.verdict.txt" |
| 527 | read -r receipt < "$home/handoffs/hive/forge/receipts/refresh.receipt.txt" |
| 528 | if [ "$after" = '# replacement visible' ] && [ "$nodes" = 'replacement nodes' ] && \ |
| 529 | [ "$verdict" = 'replacement verdict' ] && [ "$receipt" = 'replacement receipt' ]; then |
| 530 | echo 'PASS atomic RIDS, node, verdict and receipt replacements visible in same sandbox'; exit 0 |
| 531 | fi |
| 532 | echo 'FAIL atomic metadata refresh: sandbox still reads the old inode' |
| 533 | exit 1 |
| 534 | PROBE |
| 535 | chmod 755 "$T/refresh-probe" |
| 536 | mkfifo "$DATA/ready" "$DATA/go" |
| 537 | setsid bash "$WRAPPER" /usr/bin/dash -s -- "$H" < "$T/refresh-probe" > "$T/refresh.log" 2>&1 & |
| 538 | PID=$! |
| 539 | read -r ready < "$DATA/ready" |
| 540 | { echo '# replacement visible'; cat "$H/handoffs/radicle/RIDS.md"; } > "$H/handoffs/radicle/RIDS.md.new" |
| 541 | mv "$H/handoffs/radicle/RIDS.md.new" "$H/handoffs/radicle/RIDS.md" |
| 542 | cp "$H/.local/state/aien-factory/nodes.txt" "$T/nodes.before" |
| 543 | for spec in '.local/state/aien-factory/nodes.txt:nodes' 'handoffs/hive/manager/reviews/refresh.verdict.txt:verdict' 'handoffs/hive/forge/receipts/refresh.receipt.txt:receipt'; do |
| 544 | printf 'replacement %s\n' "${spec##*:}" > "$H/${spec%:*}.new" |
| 545 | mv "$H/${spec%:*}.new" "$H/${spec%:*}" |
| 546 | done |
| 547 | public_sync |
| 548 | printf 'go\n' > "$DATA/go" |
| 549 | rc=0; wait "$PID" || rc=$?; PID= |
| 550 | printf '%s\n' "$rc" > "$T/refresh.exit" |
| 551 | printf 'bash infra/test/sandbox.sh (FIFO-synchronized atomic RIDS replacement)\n' > "$T/refresh.command" |
| 552 | sha256sum "$T/refresh.log" >> "$T/SHA256SUMS" |
| 553 | if [[ $rc != 0 ]]; then |
| 554 | echo "BLOCKED metadata refresh; isolation and HTTP checks passed; evidence $T" |
| 555 | exit 4 |
| 556 | fi |
| 557 | mv "$T/nodes.before" "$H/.local/state/aien-factory/nodes.txt" |
| 558 | public_sync |
| 559 | if [[ ${SANDBOX_STORE:-0} = 1 ]]; then |
| 560 | # it reads the node snapshot (status.json, a seam in the store-reading build), pushes into the |
| 561 | # fixture's Radicle copy and adds projects through RIDS.md at run time; the store-reading build serves |
| 562 | # the store's public catalog lines, follows catalog changes without a restart (store/tests/ |
| 563 | # agentdoor-store.sh, store/tests/compare.sh reloads) and binds a new project at its next start |
| 564 | echo 'NOT_APPLICABLE refresh-supervisor: node snapshot, Radicle push and RIDS.md run-time additions are not inputs of the store-reading build' |
| 565 | else |
| 566 | record refresh-supervisor python3 infra/test/sandbox-refresh.py "$T" "$ROOT" "$PORT" |
| 567 | cp "$DATA/logs/forged.log" "$T/refresh-supervisor-service.log" |
| 568 | sha256sum "$T/restarts.json" "$T/refresh-supervisor-process.log" "$T/refresh-supervisor-service.log" >> "$T/SHA256SUMS" |
| 569 | fi |
| 570 | # netns r2: interface questions, starter descriptors, and the port held across restarts. Each |
| 571 | # control runs the scripts of the head before r2 and must show the problem. |
| 572 | record netns-ifleak netns_ifleak_check |
| 573 | record netns-ifleak-control netns_ifleak_control |
| 574 | record seccomp-guards seccomp_guard_check |
| 575 | record netns-fd netns_fd_check |
| 576 | record netns-fd-control netns_fd_control |
| 577 | record netns-taken netns_taken_check |
| 578 | record netns-race netns_race_check |
| 579 | record netns-race-control netns_race_control |
| 580 | cp "$H/handoffs/radicle/RIDS.md" "$T/RIDS.before-hold" |
| 581 | record netns-hold netns_hold_check |
| 582 | record netns-hold-control netns_hold_control |
| 583 | cp "$T/RIDS.before-hold" "$H/handoffs/radicle/RIDS.md" |
| 584 | # Listener guard: the child cannot shut down, disconnect or share the listener the supervisor holds. |
| 585 | record seccomp-table seccomp_table_check |
| 586 | record seccomp-table-control seccomp_table_control |
| 587 | record netns-poison netns_poison_check |
| 588 | record netns-poison-control netns_poison_control |
| 589 | record netns-poison-mutants netns_poison_mutants |
| 590 | # The systemd unit: forged-service.sh acts on it, it comes back after kill -9, a held port backs off. |
| 591 | record netns-unit netns_unit_check |
| 592 | record netns-unit-control netns_unit_control |
| 593 | public_sync |
| 594 | for f in "$T"/restart-hold-*.json "$T"/restart-hold-*.process.log "$T"/race-*.process.log "$T"/fd-*.out; do |
| 595 | sha256sum "$f" >> "$T/SHA256SUMS" |
| 596 | done |
| 597 | if [[ -f quiet/READY ]]; then |
| 598 | integrated_rc=0 |
| 599 | if [[ ${SANDBOX_STORE:-0} = 1 ]]; then |
| 600 | # it walks the collab routes (patch receipts, issue pages) and the Radicle seeding count, which the |
| 601 | # store-reading build composes out; the count snapshot below is the same code in both builds |
| 602 | echo 'NOT_APPLICABLE integrated-routes: collab/ routes and the Radicle seeding count are not composed in the store-reading build' |
| 603 | # the count inputs integrated-routes would make (fixtures, never the live logs or node) |
| 604 | mkdir -p "$H/count-inputs" |
| 605 | for prog in rad getent; do cp server/tests/fake/$prog "$H/count-inputs/$prog"; chmod 755 "$H/count-inputs/$prog"; done |
| 606 | touch "$H/count-inputs/wal" |
| 607 | printf '1794162545.332 203.0.113.5 200 "/rad/%s.git/info/refs?service=git-upload-pack" "git/2.56.0"\n' "$RID" > "$H/count-inputs/dl.log" |
| 608 | printf '127.0.0.1 - - [08/Nov/2026:05:57:35 -0600] "POST /rad/%s.git/git-upload-pack HTTP/2.0" 200 145 "-" "git/2.43.0"\n' "$RID" > "$H/count-inputs/access.log" |
| 609 | else |
| 610 | record integrated-routes python3 infra/test/sandbox-integrated.py "$T" "$ROOT" "$PORT" || integrated_rc=$? |
| 611 | fi |
| 612 | record count-snapshot python3 infra/test/count-snapshot.py "$T" "$ROOT" "$PORT" |
| 613 | record visits env OMC="$OMC" bash visits/tests/run.sh |
| 614 | for f in "$T"/integrated-*.strace "$T"/integrated-*-server.log "$T"/integrated-counts-comparison.json; do |
| 615 | [[ ! -f $f ]] || sha256sum "$f" >> "$T/SHA256SUMS" |
| 616 | done |
| 617 | if [[ $integrated_rc != 0 ]]; then echo "BLOCKED integrated compatibility; evidence $T"; exit "$integrated_rc"; fi |
| 618 | fi |
| 619 | echo "PASS sandbox gate; evidence $T" |