feat(ssh): support full multi-hop jump chain (#356)#1058
Conversation
| No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds utilities for detecting and traversing jump-server chains and uses them across the codebase. Introduces 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🟡 ensureKnownHostKey doesn't pass jumpSpisById to its genClient call, breaking isolate-mode jump chain resolution
The ensureKnownHostKey function was updated in this PR to accept jumpSpisById (and visitedServerIds) and correctly passes them through to its own recursive calls. However, the final genClient call at lib/core/utils/server.dart:386-391 does not forward jumpSpisById or visitedServerIds.
Root Cause and Impact
When ensureKnownHostKey is called with a non-null jumpSpisById map (intended for isolate mode where Hive stores are unavailable), it correctly uses it to resolve jump servers at lib/core/utils/server.dart:371-372:
final jumpSpi = jumpId != null ? (jumpSpisById?[jumpId] ?? Stores.server.box.get(jumpId)) : null;And correctly passes it to its own recursive call at lib/core/utils/server.dart:379:
jumpSpisById: jumpSpisById,But the genClient call at line 386 omits it:
final client = await genClient( spi, timeout: timeout, onKeyboardInteractive: onKeyboardInteractive, knownHostFingerprints: cache, );Inside genClient, when the target server has a jump chain, it attempts to resolve jump servers via jumpSpisById?[jumpId] ?? Stores.server.box.get(jumpId) (lib/core/utils/server.dart:101). Since jumpSpisById was not passed, it's null, and the code falls back to Stores.server.box.get() which would crash in an isolate context.
Impact: Currently ensureKnownHostKey is only called from the main thread (lib/core/utils/host_key_helper.dart:18), so this doesn't crash today. However, the PR specifically added the jumpSpisById parameter to support isolate-mode usage, making this an incomplete implementation — the parameter is accepted and partially propagated but not passed to the key call that needs it.
(Refers to lines 386-391)
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
b -> a -> cwhen connectingc).Changes
genClientrecursion to:ensureKnownHostKeyrecursion with cycle protection and injected jump maps.Verification
flutter analyze lib testflutter test test/jump_chain_test.dart test/ssh_config_test.dartLinked Issue
Summary by CodeRabbit
New Features
Bug Fixes
Tests