From bf163b6c17e9bda4cfe4dbe85472c8d8c3e30c97 Mon Sep 17 00:00:00 2001 From: Mark Gregory Date: Thu, 26 Nov 2026 15:54:50 +0000 Subject: [PATCH] Add dedicated runner security and resource acceptance tests --- .gitea/workflows/runner-acceptance.yaml | 101 ++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 .gitea/workflows/runner-acceptance.yaml diff --git a/.gitea/workflows/runner-acceptance.yaml b/.gitea/workflows/runner-acceptance.yaml new file mode 100644 index 0000000..a3c9f17 --- /dev/null +++ b/.gitea/workflows/runner-acceptance.yaml @@ -0,0 +1,101 @@ +name: Dedicated Runner Security Acceptance + +on: + workflow_dispatch: + +jobs: + security-acceptance: + runs-on: absdev-ci + timeout-minutes: 5 + + steps: + - name: Verify runtime + run: | + set -eu + python3 --version + node --version + git --version + echo "PASS: Runtime tools available" + + - name: Verify filesystem isolation + run: | + set -eu + test ! -e /var/run/docker.sock + test ! -e /run/docker.sock + test ! -e /data/.runner + test ! -e /config.yaml + echo "PASS: Runner files isolated" + + - name: Verify process security + run: | + set -eu + + grep -E '^NoNewPrivs:[[:space:]]+1$' \ + /proc/self/status + + python3 - <<'PY' + from pathlib import Path + + status = {} + + for line in Path("/proc/self/status").read_text().splitlines(): + if ":" in line: + key, value = line.split(":", 1) + status[key] = value.strip() + + effective = int(status["CapEff"], 16) + + restricted = { + "CAP_SYS_MODULE": 16, + "CAP_SYS_PTRACE": 19, + "CAP_SYS_ADMIN": 21 + } + + for name, bit in restricted.items(): + assert not effective & (1 << bit), name + print(f"PASS: {name} unavailable") + + assert status["Seccomp"] == "2" + print("PASS: Seccomp filtering") + PY + + - name: Verify memory limits + run: | + set -eu + cat /sys/fs/cgroup/memory.max + test "$(cat /sys/fs/cgroup/memory.max)" = "2147483648" + echo "PASS: 2 GiB memory limit" + + - name: Verify CPU limits + run: | + set -eu + cat /sys/fs/cgroup/cpu.max + read quota period < /sys/fs/cgroup/cpu.max + test "$quota" -eq "$((period * 2))" + echo "PASS: Two CPU limit" + + - name: Verify process limits + run: | + set -eu + cat /sys/fs/cgroup/pids.max + test "$(cat /sys/fs/cgroup/pids.max)" = "512" + echo "PASS: 512 process limit" + + - name: Verify network configuration + run: | + set -eu + test "$(cat /sys/class/net/eth0/mtu)" = "1400" + echo "PASS: Network MTU" + + - name: Verify writable workspace + run: | + set -eu + FILE=$(mktemp "$PWD/acceptance-XXXXXX") + printf 'acceptance-test\n' > "$FILE" + grep -Fx acceptance-test "$FILE" + rm "$FILE" + echo "PASS: Workspace operational" + + - name: Acceptance result + run: | + echo "PASS: DEDICATED RUNNER SECURITY ACCEPTANCE"