fix(runtime): bake safe.directory '*' into base image (#199, #197)#200
Merged
cbeaulieu-gt merged 1 commit intomainfrom May 5, 2026
Merged
fix(runtime): bake safe.directory '*' into base image (#199, #197)#200cbeaulieu-gt merged 1 commit intomainfrom
cbeaulieu-gt merged 1 commit intomainfrom
Conversation
actions/checkout writes the workspace as the host runner UID, but the container running as a different UID hits git's CVE-2022-24765 protection: 'fatal: detected dubious ownership'. This blocks every composite action that invokes git inside the digest-pinned overlay containers — root cause of #197. Add `git config --system --add safe.directory '*'` to the base image's Dockerfile so every overlay inherits the exemption. STAGE 4 overlay smoke (smoke-test.sh d.5) asserts the bake-in is present. `--system` (not `--global`) because /etc/gitconfig is read by every UID without a $HOME dependency — empirically confirmed in PR #198 commit 7fd62e3 that --global was invisible to claude-code-action's bun-invoked TS entrypoint. `*` (not specific workspace path) because the exemption needs to be robust to nested git operations and any future workspace path changes. Security: safe.directory '*' disables the CVE-2022-24765 check globally inside the container. The CVE protected against attackers planting malicious .git/configs; inside ephemeral GHA containers operating on workspaces we own, that threat does not apply. The new digests will be pinned in .github/workflows/claude-*.yml as a follow-up commit once STAGE 2/3 rebuild against this Dockerfile change. Closes #199. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
I'll analyze this and get back to you. |
This was referenced May 5, 2026
cbeaulieu-gt
added a commit
that referenced
this pull request
May 5, 2026
PR #200 (#199, #197) baked safe.directory '*' into the runtime base image. The reusable workflows still referenced pre-#200 overlay digests, leaving the dogfood broken. Bump all 7 occurrences to the post-merge digests produced by runtime-build run 25405636887 against commit 3bb6a22. Per-overlay substitution counts (verified): review: 2 (claude-pr-review.yml, claude-tag-respond.yml) fix: 4 (claude-apply-fix.yml, claude-ci-failure.yml, claude-lint-failure.yml, claude-tag-respond.yml) explain: 1 (claude-tag-respond.yml) total: 7 STAGE 4-overlay smoke (incl. d.5 safe.directory check) passed for all three overlays in run 25405636887, so these digests are pre-validated. Closes #201. Co-authored-by: Claude Auto-Fix <claude-autofix@users.noreply.github.com> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
git config --system --add safe.directory '*'intoruntime/base/Dockerfileimmediately after theapt-get installblock that installsgit, before the GitHub CLI install block(d.5)toruntime/scripts/smoke-test.shthat verifies the bake-in is present in every overlay image at STAGE 4CLAUDE.mdunder the CI Runtime section with a new Container git safety (post-runtime base: bakegit config --system --add safe.directory '*'into Dockerfile #199) paragraphRoot cause
actions/checkoutwrites the workspace as the host runner UID. Inside the digest-pinned overlay containers the running UID is1001(runner), not the host UID — git's CVE-2022-24765 protection fires withfatal: detected dubious ownership in repository. This blockedclaude-code-action@v1's internalgit fetch/git hash-objectsetup steps in every container-pinned workflow, causing silent or noisy failures depending on the action's error handling.Why
--systemand*Why
--systemnot--global:--globalwrites to$HOME/.gitconfig. Theclaude-code-action@v1TypeScript entrypoint is invoked viabun, which resolves$HOMEdifferently than a shell step — PR #198 commit7fd62e3confirmed empirically that--globalconfig was invisible to the action's git calls even when it was visible to shell steps in the same job.--systemwrites to/etc/gitconfig, which is read by every process and every UID without any$HOMEdependency.Why
*not a specific workspace path: The workspace path (/home/runner/work/...) is determined by the host runner at job time and injected viaGITHUB_WORKSPACE. Hardcoding it in the image would break if the path changes (different consumer repo, future runner version).*is robust to any workspace path, to nested git operations, and to any futureactions/checkoutchanges.Security analysis
safe.directory '*'disables the CVE-2022-24765 ownership check globally inside the container. The CVE was designed to protect against an attacker placing a malicious.git/configin a directory that a privileged usercds into on a shared host. Inside an ephemeral GHA container:actions/checkout— a trusted action operating on the consumer's own repoThe threat model the CVE defends against does not apply. This analysis matches PR #198's security assessment and the spec §7.3 amendment rationale referenced in the Dockerfile comment.
Smoke test coverage
New section
(d.5)inruntime/scripts/smoke-test.shruns:inside the container as UID
$SMOKE_UID(non-root) and asserts the output contains a line matching*exactly. A Dockerfile edit that accidentally removes or shadows/etc/gitconfigwould fail this check at STAGE 4 before any overlay digest is promoted.Test plan
pull_requestgate onruntime/**).github/workflows/claude-*.yml(review/fix/explain — 5 workflow files affected)Closes #199
Closes #197
🤖 Generated by Claude Code on behalf of @cbeaulieu-gt