Fix SSH host key verification: hostname format, tempfile dep, TempDir leak#8
Merged
persimmon16 merged 2 commits intofeat/apple-containerfrom Apr 1, 2026
Conversation
… leak Three bugs from the initial SSH host-key PR (#4): 1. known_hosts wrote [sandbox]:2222 but SSH connects to "sandbox" at default port 22 — entry never matched, defeating StrictHostKeyChecking. Fixed to use bare "sandbox" hostname. 2. tempfile crate was only in [dev-dependencies] for openshell-cli, breaking release builds. Moved to [dependencies]. 3. TempDir::into_path() disabled automatic cleanup, leaking temp directories. Changed to return the TempDir guard so callers keep it alive until SSH exits, then cleanup runs on drop. Also fixes borrow-checker error in grpc.rs auth check (PR #5) where .ok_or_else() borrowed request while into_inner() tried to move it.
The macos-15 runner doesn't ship with Apple Container pre-installed. Download the signed .pkg installer from the GitHub release and install it before running container system info.
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
Follow-up to PR #4 (Enable SSH host key verification). Fixes three bugs found during post-merge code review:
known_hosts hostname mismatch (security): Entries were written as
[sandbox]:2222but SSH connects to hostnamesandboxat default port 22. The entry never matched, causingStrictHostKeyChecking=yesto reject every connection when a fingerprint was provided — silently defeating the host key verification feature. Fixed to use baresandboxformat.Missing production dependency (build blocker):
tempfilewas only in[dev-dependencies]foropenshell-cli, so release builds fail. Moved to[dependencies].TempDir resource leak:
TempDir::into_path()disables automatic cleanup, leaking temp directories on each SSH connection. Changedssh_base_command(CLI) andapply_host_key_args(TUI) to return theTempDirguard; callers hold it until SSH exits, then drop triggers cleanup.Also fixes a borrow-checker error in
grpc.rsfrom PR #5's auth bypass fix (.ok_or_else()borrowsrequestwhileinto_inner()moves it).Test plan
cargo buildpasses (no more missingtempfilein release)cargo test— all tests passcargo clippy— no new warnings (pre-existing pedantic lints only)StrictHostKeyChecking=yeswhen fingerprint is provided