Files
MyAiConfiguration/shared/hooks/scripts/validate-command-safety.sh
T
Julian lechnerandClaude Sonnet 5 1163f6d96e fix: mark shell scripts executable in git
All tracked .sh files were stored as mode 100644 (non-executable), even
though the CI workflow and normal usage invoke several of them directly
(./scripts/build.sh) rather than through `bash`. On a fresh Linux
checkout this fails with a permission error.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-11 16:06:37 +02:00

10 lines
393 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
command_text=${1:?Command is required}
workspace=${2:-$PWD}
for pattern in 'git reset --hard' 'git clean -fd' 'git clean -fx' 'rm -rf' 'Remove-Item -Recurse' 'format c:' 'del /s /q'; do
[[ ${command_text,,} != *"${pattern,,}"* ]] || { printf 'Blocked potentially destructive command: %s\n' "$pattern" >&2; exit 1; }
done
printf 'PASS command safety\n'