Add dedicated runner security and resource acceptance tests
ABSDEV Framework CI / framework-ci (push) Successful in 41s
ABSDEV Framework CI / framework-ci (push) Successful in 41s
This commit is contained in:
@@ -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"
|
||||
Reference in New Issue
Block a user