#!/usr/bin/env bash set -euo pipefail # Source only the prompt helpers; executing mosaic-init itself requires templates. source <(head -n 144 "$(dirname "$0")/mosaic-init") rm -f /tmp/pwned payload='literal "$(touch /tmp/pwned)"' AGENT_NAME="" prompt_if_empty AGENT_NAME "Agent name" <<<"$payload" [[ "$AGENT_NAME" == "$payload" ]] || { echo "FAIL: prompt answer did not round-trip literally" >&2 exit 1 } [[ ! -e /tmp/pwned ]] || { echo "FAIL: prompt answer executed code" >&2 rm -f /tmp/pwned exit 1 } echo "mosaic-init RCE regression: PASS"