fix: match real token format in pre-commit secret scan

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SfihHazrSHXgndJtSNLubJ
This commit is contained in:
Tony Averty 2026-10-21 15:06:19 +02:00
parent c1d6868a2e
commit 991afb9c71
No known key found for this signature in database

View file

@ -13,7 +13,7 @@ if [ -n "$bad" ]; then
fi fi
scan=$(echo "$staged" | grep -v '^\.githooks/') scan=$(echo "$staged" | grep -v '^\.githooks/')
if [ -n "$scan" ] && git diff --cached -U0 -- $scan | grep -E '^\+' | grep -Ei '(sk-ant-|ghp_[A-Za-z0-9]{20}|-----BEGIN [A-Z ]*PRIVATE KEY|GOCSPX-)' >/dev/null; then if [ -n "$scan" ] && git diff --cached -U0 -- $scan | grep -E '^\+' | grep -E '(sk-ant-[a-z]+[0-9]{2}-[A-Za-z0-9_-]{20,}|ghp_[A-Za-z0-9]{20}|-----BEGIN [A-Z ]*PRIVATE KEY|GOCSPX-)' >/dev/null; then
echo "✗ Un secret semble présent dans le diff. Vérifie avant de commit."; exit 1 echo "✗ Un secret semble présent dans le diff. Vérifie avant de commit."; exit 1
fi fi