#!/bin/sh set -eu cd "$(dirname "$0")/.." identity=$1 shift case "$identity" in revoked-*) path="$PWD/secrets/operator/pki/$identity" ;; *) path="$PWD/secrets/tls/$identity" ;; esac docker run --rm -i --network "${COMPOSE_PROJECT_NAME:-messenger-lab7}_${PROBE_NETWORK:-backend}" \ --user 1000:1000 --read-only --cap-drop ALL --security-opt no-new-privileges:true \ --mount "type=bind,src=$path,dst=/run/identity,readonly" \ --mount "type=bind,src=$PWD/secrets/tls/service-ca,dst=/run/tls,readonly" \ --mount "type=bind,src=$PWD/student-tests/security-probe.mjs,dst=/app/student-tests/security-probe.mjs,readonly" \ -e PROBE_HOST -e PROBE_EXPECT -e PROBE_NO_CERT -e PROBE_ROLE -e PROBE_KEY -e NODE_EXTRA_CA_CERTS=/run/tls/ca.crt \ "$@" messenger-lab7-app:dev node /app/student-tests/security-probe.mjs "${PROBE_MODE:-tls}"