diff --git a/.github/workflows/security-review.yml b/.github/workflows/security-review.yml index e7df93d..d8bb5e8 100644 --- a/.github/workflows/security-review.yml +++ b/.github/workflows/security-review.yml @@ -82,9 +82,13 @@ name: Security-Review # checks. The part on correctness measures against what a reasonable person # expects as well and lists what the agent set aside. # -# A caller grants checks: write, contents: read, id-token: write, issues: +# A caller grants checks: write, contents: write, id-token: write, issues: # read, pull-requests: write and security-events: write; without any of them -# GitHub does not start the workflow. It triggers on pull_request and on +# GitHub does not start the workflow. contents: write goes to the job that +# publishes alone, which closes the threads of earlier runs: GitHub lets only +# who may write to the repository resolve a conversation. That job runs +# nothing of the pull request or of the agent; the review reads with +# contents: read. It triggers on pull_request and on # pull_request_target, both with the types opened, synchronize, reopened and # ready_for_review: a draft is skipped, and without the last type one marked # ready would get no review until its next push. @@ -2830,6 +2834,10 @@ jobs: # A configuration folder of its own for each call, where the sandbox # writes nothing: the settings and hooks a later call reads are never # what the agent of an earlier one left in the home of the runner. + # And git, which Claude Code starts outside the sandbox, looks for no + # repository above the folder the call starts in: the sandbox lets + # the agent write in /home/runner and /home/runner/work, and a .git + # it left there would otherwise be found from a folder without one. config_dir="$RUNNER_TEMP/claude-main" run_review() { env -u ACTIONS_ID_TOKEN_REQUEST_TOKEN -u ACTIONS_ID_TOKEN_REQUEST_URL \ @@ -2843,6 +2851,7 @@ jobs: XDG_CACHE_HOME="$cache/xdg" \ DISABLE_AUTOUPDATER=1 BUN_RUNTIME_TRANSPILER_CACHE_PATH=0 \ CLAUDE_CONFIG_DIR="$config_dir" \ + GIT_CEILING_DIRECTORIES="$(dirname "$PWD")" \ "$@" \ "${limit[@]}" claude -p --safe-mode --setting-sources user --strict-mcp-config --no-session-persistence \ --settings "$run_settings" \ @@ -2960,6 +2969,10 @@ jobs: search_path="$PATH" cache="$RUNNER_TEMP/alerts-cache" config_dir="$RUNNER_TEMP/claude-alerts" + # An empty repository of its own, so that git stops there even where + # Claude Code would not pass the ceiling on; no template, no hooks, + # and none of the configuration in the home of the runner. + HOME="$tool_home" GIT_CONFIG_NOSYSTEM=1 git init -q --template= "$RUNNER_TEMP/alerts-base" (cd "$RUNNER_TEMP/alerts-base" && scrub=0 && run_review "${account[@]}") echo "Die Prüfung der privaten Befunde endete mit Exit $?." fi @@ -3635,8 +3648,12 @@ jobs: needs: [mode, review] if: ${{ !cancelled() && needs.mode.outputs.handles == 'true' }} runs-on: ubuntu-latest + # contents: write to resolve the threads of earlier runs, which GitHub + # allows only who may write to the repository; the job checks nothing + # out and calls fixed endpoints with JSON alone. permissions: checks: write + contents: write pull-requests: write steps: - name: Ergebnis holen