@@ -1,41 +0,0 @@
3−# Script to check for hidden/invisible characters in Go files
4−# This helps detect potential prompt injection attempts
6−echo "Checking Go files for hidden characters..."
8−# Find all Go files in the repository
9−go_files=$(find . -name "*.go" -type f)
11−# Counter for files with hidden characters
14−for file in $go_files; do
15− # Check for specific Unicode hidden characters that could be used for prompt injection
16− # This excludes normal whitespace like tabs and newlines
18− # - Zero-width spaces (U+200B)
19− # - Zero-width non-joiners (U+200C)
20− # - Zero-width joiners (U+200D)
21− # - Left-to-right/right-to-left marks (U+200E, U+200F)
22− # - Bidirectional overrides (U+202A-U+202E)
23− # - Byte order mark (U+FEFF)
24− if hexdump -C "$file" | grep -E 'e2 80 8b|e2 80 8c|e2 80 8d|e2 80 8e|e2 80 8f|e2 80 aa|e2 80 ab|e2 80 ac|e2 80 ad|e2 80 ae|ef bb bf' > /dev/null 2>&1; then
25− echo "Hidden characters found in: $file"
27− # Show the file with potential issues
28− echo " Hexdump showing suspicious characters:"
29− hexdump -C "$file" | grep -E 'e2 80 8b|e2 80 8c|e2 80 8d|e2 80 8e|e2 80 8f|e2 80 aa|e2 80 ab|e2 80 ac|e2 80 ad|e2 80 ae|ef bb bf' | head -10
31− files_with_hidden=$((files_with_hidden + 1))
35−if [ $files_with_hidden -eq 0 ]; then
36− echo "No hidden characters found in any Go files."
38− echo "Found hidden characters in $files_with_hidden Go file(s)."
41−exit $files_with_hidden # Exit with number of affected files as status code