#!/usr/bin/env bash set -euo pipefail cd "$(dirname "$0")/.." image="${1:-postgres:16.15-alpine}" scripts/docker.sh run --rm --network none --user "${PROBE_UID:-$(id -u)}:${PROBE_GID:-$(id -g)}" \ --read-only --cap-drop ALL --security-opt no-new-privileges:true \ --entrypoint /bin/sh "$image" -ec ' test "$(id -u)" -ne 0 grep -Eq "^NoNewPrivs:[[:space:]]+1$" /proc/self/status grep -Eq "^CapEff:[[:space:]]+0+$" /proc/self/status echo "PASS: non-root, read_only, cap_drop=ALL, NoNewPrivs=1" '