fix: scope the auth header to the Gitea server; README trust note

- review.yml and git.push set http.<GITHUB_SERVER_URL>/.extraHeader, so the bot token
  is sent only to the Gitea server; git.push falls back to the unscoped key when no
  server is known.
- README: a same-repository PR runs the caller workflow from its head, so the
  safeguards bound PR content, not edits to the caller; drafter: local fails the job.
- Tests: the source-grep fetch test is replaced by a behavioral one over a resumed run
  (fetch ends options, push uses the scoped key); the no-op summary test is dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jaredandClaude Opus 5.5 committed 2026-11-12 15:06:30 -05:00
1 parent 7783b6e78f
commit 70c762bf8a
7 files changed
+64 -23

No files matched your search

+5 -5
View File
@@ -128,8 +128,8 @@ jobs:
echo "drafter=$drafter" >> "$GITHUB_OUTPUT"
# Full history, so merge bases and the docs branch's ancestry resolve. The token
# travels as an http.extraHeader in this command's environment, so it is never
# written to .git/config or a remote URL.
# travels as an http.<server>/.extraHeader in this command's environment, so it is
# sent only to the Gitea server and never written to .git/config or a remote URL.
- name: Clone the calling repository
if: github.event_name != 'pull_request' || github.event.action != 'closed'
env:
@@ -140,7 +140,7 @@ jobs:
echo "::error::the DOCS_REVIEW_BOT_TOKEN secret is not set"
exit 1
fi
export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=http.extraHeader \
export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0="http.${GITHUB_SERVER_URL}/.extraHeader" \
GIT_CONFIG_VALUE_0="Authorization: token $DOCS_REVIEW_BOT_TOKEN"
src="$(mktemp -d)"
if ! git clone -q -- "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git" "$src"; then
@@ -177,7 +177,7 @@ jobs:
DOCS_REVIEW_STAGE: "1"
run: |
set -eu
export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=http.extraHeader \
export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0="http.${GITHUB_SERVER_URL}/.extraHeader" \
GIT_CONFIG_VALUE_0="Authorization: token $DOCS_REVIEW_BOT_TOKEN"
if [ "$EVENT" = "pull_request" ]; then
python3 -P -m docs_review pr --number "$PR" --base "$BASE" \
@@ -220,7 +220,7 @@ jobs:
npm install -g --no-fund --no-audit "@anthropic-ai/claude-code@$CLAUDE_CODE_VERSION"
claude --version
fi
export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=http.extraHeader \
export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0="http.${GITHUB_SERVER_URL}/.extraHeader" \
GIT_CONFIG_VALUE_0="Authorization: token $DOCS_REVIEW_BOT_TOKEN"
if [ "$EVENT" = "pull_request" ]; then
python3 -P -m docs_review pr --number "$PR" --base "$BASE" \