fix(worker): security audit of R0 — no core dumps, tkill/tgkill limited to SIGABRT on self, mmap without PROT_EXEC, Broken outcome for a broken child environment, frame vs canvas check, unsafe denied with local allows, sandbox tests and derivation on the release profile (syscall marker); wasm proof exports behind a feature; ci: release-images hardened (typed input via env, advisories gate, ephemeral builder, env secrets + logout, ref gate, pinned checkout)
This commit is contained in:
1 parent
9d3e0294e2
commit
11813f5560
14 files changed
+293
-58
No files matched your search
@@ -9,8 +9,8 @@
|
||||
# review (the abort path is expected there).
|
||||
set -eu
|
||||
|
||||
bin=target/debug/faunosteo-worker
|
||||
cargo build -p faunosteo-worker --features test-hooks --locked
|
||||
bin=target/release/faunosteo-worker
|
||||
cargo build -p faunosteo-worker --release --features test-hooks --locked
|
||||
work=$(mktemp -d)
|
||||
|
||||
fixtures="png jpeg webp big-jpeg big-png"
|
||||
@@ -18,15 +18,22 @@ fixtures="png jpeg webp big-jpeg big-png"
|
||||
for kind in $fixtures; do
|
||||
"$bin" fixture "$kind" > "$work/$kind.bin"
|
||||
# `env -i`: the child refuses a non-empty environment; `--no-seccomp` keeps the rlimits
|
||||
# and prints the marker where the filter would be installed.
|
||||
# and makes one sched_yield where the filter would be installed (strace cannot read the
|
||||
# child's memory once PR_SET_DUMPABLE is 0, so the marker is a syscall, not a string).
|
||||
env -i strace -f -qq -o "$work/trace.$kind" "$bin" decode --no-seccomp \
|
||||
< "$work/$kind.bin" > "$work/$kind.webp"
|
||||
awk 'found { print } /SECCOMP-MARKER/ { found = 1 }' "$work/trace.$kind" \
|
||||
awk 'found { print } /sched_yield\(/ { found = 1 }' "$work/trace.$kind" \
|
||||
| sed -E 's/^[0-9]+ +//; /^(\+\+\+|---)/d; s/^<\.\.\. ([a-z0-9_]+) resumed>.*/\1/; s/\(.*//' \
|
||||
| grep -E '^[a-z0-9_]+$' >> "$work/traced.raw" || true
|
||||
done
|
||||
sort -u "$work/traced.raw" > "$work/traced.txt"
|
||||
"$bin" print-allowlist | sort -u > "$work/allowed.txt"
|
||||
if [ ! -s "$work/traced.txt" ]; then
|
||||
echo "== NO SYSCALL TRACED AFTER THE MARKER: the derivation is broken, not the allowlist" >&2
|
||||
echo "== tail of the png trace:" >&2
|
||||
tail -n 40 "$work/trace.png" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "== syscalls traced after the sandbox marker"
|
||||
cat "$work/traced.txt"
|
||||
|
||||
Reference in new issue
Block a user