feat: forward the host SSH agent into the sandbox ([container] ssh) - #63
Open
TakiTake wants to merge 1 commit into
Open
feat: forward the host SSH agent into the sandbox ([container] ssh)#63TakiTake wants to merge 1 commit into
TakiTake wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The default image bakes GitHub's SSH host keys so git-over-SSH works without a TOFU prompt, but nothing forwarded an agent — so the only way to authenticate was a private key sitting in ~/.pall8t/home/.ssh, where the sandboxed agent can read it and where it stays after the run. apple/container forwards the agent socket instead: `--ssh` takes SSH_AUTH_SOCK from the client's environment, mounts that socket into the guest at /var/host-services/ssh-auth.sock, and points the container's own SSH_AUTH_SOCK at it. No key material crosses the boundary, only signing requests. DESIGN.md already had this as the intended v3.2 shape. - `[container] ssh` (global + project, project wins), default false, plus `pall8t run --ssh` / `--ssh=false` for one run — same precedence as `--readonly`. Off by default because while the run lasts, code in the sandbox can authenticate as the user anywhere their keys are trusted. - Warn when forwarding is on and the host has no SSH_AUTH_SOCK: the runtime forwards nothing but still sets SSH_AUTH_SOCK inside the container, so the only other symptom is a connect failure. Verified live on container 1.2.2: `ssh-add -l` inside the sandbox reaches the host agent (protocol answer, not a connection failure); `--ssh=false` and config-off leave SSH_AUTH_SOCK unset inside; `--ssh` overrides a config that had it off; and the no-agent warning fires. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YTFLvjR7dWvxFQfSyBY4Zm
TakiTake
force-pushed
the
feat/container-ssh
branch
from
August 23, 2026 23:02
285a444 to
96cdcf6
Compare
This was referenced Aug 23, 2026
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.
Closes #54. Stacked on #62 (
feat/herdr-socket-bridge) — GitHub retargets this tomainonce that merges. Only the last commit belongs to this PR.Why
The default image bakes GitHub's SSH host keys so git-over-SSH works without a TOFU prompt (
.pall8t/Containerfile), but nothing forwarded an agent — so the only way to actually authenticate was a private key inside~/.pall8t/home/.ssh: readable by the sandboxed agent, and still there after the run.docs/design/DESIGN.md:220,230already called for--sshas a per-project opt-in.container run --sshtakesSSH_AUTH_SOCKfrom the client's environment, forwards that socket into the guest at/var/host-services/ssh-auth.sock(UnixSocketConfiguration(direction: .into)), and sets the container's ownSSH_AUTH_SOCKto it. No key material crosses the boundary — only signing requests.What
[container] sshin global and project config (project wins), defaultfalse.pall8t run --ssh/--ssh=falsefor one run — the same precedence as--readonly(flag beats config beats default), as a pureconfig::ssh_enabled.SSH_AUTH_SOCK(config::ssh_warning): verified on 1.2.2, the runtime logs that to its own log, forwards nothing, and still setsSSH_AUTH_SOCKinside the container — so without the warning the only symptom issshfailing to connect to a socket that was never there.Verification
Unit: 112 tests,
scripts/lint.shclean.cargo mutants -f src/config.rs: nothing missed in the new code (the 4 misses are pre-existingas_str/path helpers).Live, on container 1.2.2, with an alpine test image running as
dev(uid 501):ssh = trueSSH_AUTH_SOCK=/var/host-services/ssh-auth.sock;ssh-add -l→ "The agent has no identities" (exit 1 — a protocol answer from the host agent, not a connect failure)ssh = true+--ssh=falseSSH_AUTH_SOCKunset insidessh = falseSSH_AUTH_SOCKunset insidessh = false+--ssh--sshwith no host agentSSH_AUTH_SOCK, exactly as the warning says🤖 Generated with Claude Code
https://claude.ai/code/session_01YTFLvjR7dWvxFQfSyBY4Zm