Repository navigation
[v0.2] Add the ProxyJump integration matrix - #33
Merged
Merged
Conversation
OpenSSH expands %h/%p across the whole ProxyCommand value, nested commands included, so the escaped inner tokens now survive the outer pass and each hop forwards to its own destination. Without this the second hop connected to the target directly and the hop was skipped. The integration fixture grows into the matrix from #14: one, two, and three hops, a saved-profile hop, rejected credentials, a stopped hop, and a reversed chain, each also asserting no ssh outlives the failure. Refs #14 Signed-off-by: Xingqiu Xu <hilbertanjou83@gmail.com>
4 tasks
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.
Parent: #1
Closes #14
The matrix
tests/proxyjump_sshd.rsnow covers, against containerizedsshdon a private Docker network:line_connects_through_a_single_containerized_jump_hostline_connects_through_two_containerized_jump_hostsline_connects_through_three_containerized_jump_hostsline_connects_through_a_saved_profile_jump_hostline_reports_rejected_credentialsPermission deniedline_reports_an_unavailable_hopline_reports_a_reversed_chainEvery failing scenario also asserts that no
sshprocess from the chain outlives the failure, so a broken chain cannot leave a child holding the terminal. The whole suite runs in about eight seconds, and the fixture now takes a hop count plus small mutators (use_saved_profile_hop,use_unauthorized_identity,stop_hop,reverse_chain) instead of one hard-coded shape.The bug this found
The stopped-hop scenario returned exit 0. OpenSSH expands
%h/%pacross the entire ProxyCommand value, nested quotes included, so inssh -o ProxyCommand="ssh ... -W %h:%p -- hop1" -W %h:%p -- hop2the inner%h:%pwas expanded against the target, not hop 2. The second hop therefore forwarded straight to the target: the connection succeeded, the hop was silently skipped, and it only looked correct because the target'ssshdaccepted the same key.The fix doubles the percent signs in the embedded command (
shell_quote_nested), so the outer pass turns%%h:%%pinto%h:%pand the nested OpenSSH process expands it against its own destination. Each nesting level escapes once more, which the three-hop case now pins down. ADR-0002 records the rule.This is exactly the class of defect the ticket existed to catch: it is invisible to command-shape unit tests and to a happy-path integration test.
Note on terminal cleanup
The integration tests use
line <name>, the CLI connect path, which never enters raw mode or the alternate screen — so there is no terminal state to restore at that level, and the asserted property there is process cleanup (no survivingssh). Terminal restoration belongs to the TUI path (TuiSession::suspend/resume/Drop), which #3 moved behind the platform seam and covered with its own tests.Verification
cargo test --all-targets --locked(123 lib tests, seven containerized integration tests, every other suite),cargo clippy --all-targets --all-features --locked -- -D warnings,cargo +1.88.0 check --all-targets --locked,cargo fmt --check.