Files
felhom.eu/documentation/audits/d63-2026-10-29/floor.sh
T

13 lines
837 B
Bash

#!/usr/bin/env bash
# floor.sh <token NAME> <path> <min_controller_version or ""> <min_agent or ""> — one floor save at the hub with CC's
# scoped token (decision 251). The token arrives through `sec run` under the NAME; it goes to curl through a header file
# in $XDG_RUNTIME_DIR (printf is a builtin, so the value is never on a command line) and is never printed.
# Prints the status line and the Location header only: 303 to ?flash=floor_set is success; any other flash is a refusal.
set -euo pipefail
NAME=$1; P=$2; VER=$3; MA=$4
H=$(mktemp -p "${XDG_RUNTIME_DIR:-/tmp}")
printf "Authorization: Bearer %s\n" "${!NAME}" > "$H"
curl -s -o /dev/null -D - -H @"$H" --data-urlencode "min_controller_version=$VER" --data-urlencode "min_agent=$MA" \
"http://10.43.52.34:8080$P" | grep -iE "^HTTP|^location" || true
: > "$H"; rm -f "$H"