interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / infra / test / slow-client.sh

22 lines · 1456 bytes Raw Blame History
1#!/usr/bin/env bash
2# Security review P2-1 (forge-web-13102b54): a slow archive download must not stall the forge.
3# Runs the REAL forged binary against the real (read-only) Radicle storage, behind a COPY of the
4# hub's live /etc/nginx, in a throwaway ubuntu:26.04 container (the hub runs Ubuntu 26.04,
5# nginx 1.28.3). Phase A uses the config as deployed (negative control: expect the stall),
6# phase B overlays this tree's nginx files (expect no stall). Reads the hub; changes nothing there.
7# Run on spark: taskset -c 2 nice -n 10 bash infra/test/slow-client.sh
8set -u
9INFRA=$(cd "$(dirname "$0")/.." && pwd)
10FORGED=${FORGED_BIN:-$INFRA/../server/forged}
11H=/home/drakestapleton
12[ -x "$FORGED" ] || { echo "no forged binary at $FORGED"; exit 2; }
13W=$(mktemp -d /tmp/forge-slow.XXXXXX)
14trap 'rm -rf "$W"' EXIT
15ssh -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" \
16 || { echo "could not read hub /etc/nginx"; exit 2; }
17echo "hub /etc/nginx copy: sha256 $(sha256sum < "$W/etc-nginx.tar" | cut -c1-16); forged sha256 $(sha256sum < "$FORGED" | cut -c1-16)"
18docker run --rm --cpuset-cpus "${SLOW_CPUS:-2}" \
19 -v "$INFRA:/infra:ro" -v "$W:/w:ro" -v "$FORGED:/forged:ro" \
20 -v "$H/.radicle/storage:$H/.radicle/storage:ro" \
21 -v "$H/handoffs/radicle/RIDS.md:$H/handoffs/radicle/RIDS.md:ro" \
22 ubuntu:26.04 bash /infra/test/slow-client-inner.sh