#!/usr/bin/env bash # Prove whether the sensitive-path rule blocks files that actually exist. set -uo pipefail ROOT=/www/wwwroot/demo mkdir -p "$ROOT/.well-known" "$ROOT/blog" "$ROOT/docs" "$ROOT/download" printf 'zip-demo' > "$ROOT/download/app.zip" printf 'pkg-demo' > "$ROOT/download/pkg.tar.gz" printf 'security-contact' > "$ROOT/.well-known/security.txt" printf 'guide' > "$ROOT/blog/phpmyadmin-guide" printf 'dump' > "$ROOT/docs/app.sql" printf ' "$ROOT/wp-login.php" printf 'body{}' > "$ROOT/style.css" H='Host: demo.test' req() { printf '%-38s -> %s\n' "$1" "$(curl -s -o /dev/null -w '%{http_code}' -H "$H" "http://127.0.0.1$1")" } req /style.css req /download/app.zip req /download/pkg.tar.gz req /.well-known/security.txt req /blog/phpmyadmin-guide req /docs/app.sql req /wp-login.php rm -rf "$ROOT/.well-known/security.txt" "$ROOT/blog/phpmyadmin-guide" \ "$ROOT/docs/app.sql" "$ROOT/wp-login.php" "$ROOT/download" "$ROOT/style.css" rmdir "$ROOT/.well-known" "$ROOT/blog" "$ROOT/docs" 2>/dev/null || true