interplane-forge
INTERPLANE Forge
Brought by drakestapleton
interplane-forge / infra / test / raw-csp.sh
| 1 | #!/usr/bin/env bash |
| 2 | # Security review P2-3: the edge must pass forged's raw sandbox CSP through, not hide it. |
| 3 | # Runs the REAL forged binary against the real (read-only) Radicle storage, behind a COPY of the |
| 4 | # hub's /etc/nginx, in a throwaway ubuntu:26.04 container. Old: the P2-1 edge files from the hub's |
| 5 | # staged tree (default /tmp/forge-infra-p21/infra; negative control: expect the edge's CSP on raw). |
| 6 | # New: hub/forge-edge-update.sh installs this tree (expect forged's sandbox CSP, alone). |
| 7 | # Reads the hub; changes nothing there. |
| 8 | # Run on spark: taskset -c 2 nice -n 10 bash infra/test/raw-csp.sh |
| 9 | set -u |
| 10 | INFRA=$(cd "$(dirname "$0")/.." && pwd) |
| 11 | FORGED=${FORGED_BIN:-$INFRA/../server/forged} |
| 12 | OLD=${OLD_TREE:-/tmp/forge-infra-p21/infra} |
| 13 | H=/home/drakestapleton |
| 14 | [ -x "$FORGED" ] || { echo "no forged binary at $FORGED"; exit 2; } |
| 15 | W=$(mktemp -d /tmp/forge-rawcsp.XXXXXX) |
| 16 | trap 'rm -rf "$W"' EXIT |
| 17 | ssh -o BatchMode=yes hub 'sudo -n tar -C /etc -cf - --exclude=nginx/certs --exclude=nginx/sitehub-backups --exclude=nginx/forge-backups nginx' > "$W/etc-nginx.tar" \ |
| 18 | || { echo "could not read hub /etc/nginx"; exit 2; } |
| 19 | rsync -a "hub:$OLD/" "$W/old/" || { echo "could not read hub $OLD"; exit 2; } |
| 20 | echo "hub /etc/nginx copy: sha256 $(sha256sum < "$W/etc-nginx.tar" | cut -c1-16); old tree hub:$OLD; forged sha256 $(sha256sum < "$FORGED" | cut -c1-16)" |
| 21 | docker run --rm --cpuset-cpus "${RAWCSP_CPUS:-2}" \ |
| 22 | -v "$INFRA:/infra:ro" -v "$W:/w:ro" -v "$FORGED:/forged:ro" \ |
| 23 | -v "$H/.radicle/storage:$H/.radicle/storage:ro" \ |
| 24 | -v "$H/handoffs/radicle/RIDS.md:$H/handoffs/radicle/RIDS.md:ro" \ |
| 25 | ubuntu:26.04 bash /infra/test/raw-csp-inner.sh |