forked from Curbob/LobsterBoard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpre-commit
More file actions
30 lines (27 loc) · 793 Bytes
/
Copy pathpre-commit
File metadata and controls
30 lines (27 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# Pre-commit hook: block private data in template configs
# Install: cp pre-commit .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit
PATTERNS=(
'private-[a-f0-9]{6}'
'caldav\.icloud\.com'
'calendar\.google\.com/calendar/ical/.*private'
'@gmail\.com'
'@allinialglobal\.com'
'sk-ant-'
)
FAILED=0
for f in $(git diff --cached --name-only -- 'templates/' 2>/dev/null); do
[ -f "$f" ] || continue
for pat in "${PATTERNS[@]}"; do
if git show ":$f" 2>/dev/null | grep -qiE "$pat"; then
echo "❌ Private data detected in $f (pattern: $pat)"
FAILED=1
fi
done
done
if [ $FAILED -ne 0 ]; then
echo ""
echo "⚠️ Commit blocked: template files contain private data."
echo " Strip sensitive URLs/emails before committing."
exit 1
fi