File size: 1,176 Bytes
ef6eb55 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #!/bin/bash
# PAX-Coder Protected Execution Gate (ADR-0009)
#
# Shell wrapper for backward compatibility.
# The actual gate logic is in pax_coder_gate.py (native Ed25519, Pydantic).
#
# This wrapper:
# 1. Locates the Python gate
# 2. Passes through environment and arguments
# 3. Preserves exit codes
#
# Exit codes (passed through from Python):
# 0 = AUTHORIZED (protected execution allowed)
# 1 = INTEGRITY_FAILED (release verification failed)
# 2 = AUTHORIZATION_DENIED (node not authorized or capability missing/invalid)
# 3 = SCRIPT_ERROR (cannot determine status)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(dirname "$SCRIPT_DIR")"
# Export repo root for the Python gate
export PAX_REPO_ROOT="$REPO_ROOT"
# Locate Python gate
PYTHON_GATE="$REPO_ROOT/pax_coder_gate.py"
if [ ! -f "$PYTHON_GATE" ]; then
echo "ERROR: Python gate not found at $PYTHON_GATE"
exit 3
fi
# Check Python3 is available
if ! command -v python3 &> /dev/null; then
echo "ERROR: python3 not found in PATH"
exit 3
fi
# Execute Python gate with all arguments passed through
exec python3 "$PYTHON_GATE" "$@"
|