interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / infra / test / raw-csp.sh

25 lines · 1634 bytes Raw Blame History
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
9set -u
10INFRA=$(cd "$(dirname "$0")/.." && pwd)
11FORGED=${FORGED_BIN:-$INFRA/../server/forged}
12OLD=${OLD_TREE:-/tmp/forge-infra-p21/infra}
13H=/home/drakestapleton
14[ -x "$FORGED" ] || { echo "no forged binary at $FORGED"; exit 2; }
15W=$(mktemp -d /tmp/forge-rawcsp.XXXXXX)
16trap 'rm -rf "$W"' EXIT
17ssh -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; }
19rsync -a "hub:$OLD/" "$W/old/" || { echo "could not read hub $OLD"; exit 2; }
20echo "hub /etc/nginx copy: sha256 $(sha256sum < "$W/etc-nginx.tar" | cut -c1-16); old tree hub:$OLD; forged sha256 $(sha256sum < "$FORGED" | cut -c1-16)"
21docker 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