SSH Connection Pool & Host Verification
Description
Implement an SSH connection pool to reuse connections across multiple operations, and add robust host verification to ensure secure connections to known hosts. This prevents connection exhaustion and adds security guards against MITM attacks.
Business Value
- Performance: Reusing SSH connections reduces latency for sequential operations on the same host
- Resource efficiency: Prevents connection leaks and port exhaustion
- Security: Host key verification prevents MITM attacks and validates known_hosts
- Reliability: Automatic connection recovery and cleanup on failure
Acceptance Criteria
Tests Required
Implementation Notes
- Base pool on
ssh2 client library connection management
- Store known_hosts in
~/.ssh/known_hosts standard format for interoperability
- Pool key:
{host}:{port}@{user} for uniqueness
- Connection validation: send a no-op command before reusing from pool
- Telemetry fields:
poolSize, reuseCount, evictionCount, verifyStatus (accepted/rejected/mismatch)
- Consider async connection establishment to avoid blocking the UI
- Host verification should be skippable via config for testing/air-gapped environments (default: required)
Related Issues
Environment
- VS Code 1.95+
- All platforms (Windows, macOS, Linux)
- Requires
ssh2 npm package
SSH Connection Pool & Host Verification
Description
Implement an SSH connection pool to reuse connections across multiple operations, and add robust host verification to ensure secure connections to known hosts. This prevents connection exhaustion and adds security guards against MITM attacks.
Business Value
Acceptance Criteria
~/.ssh/known_hostsbefore connectingchamp.ssh.poolMaxConnections,champ.ssh.connectionIdleTimeoutSeconds,champ.ssh.verifyHostKeyTests Required
Implementation Notes
ssh2client library connection management~/.ssh/known_hostsstandard format for interoperability{host}:{port}@{user}for uniquenesspoolSize,reuseCount,evictionCount,verifyStatus(accepted/rejected/mismatch)Related Issues
Environment
ssh2npm package