The ssh2 sidecar connected with no host-key verification, so a MITM could present its own key and capture the (decrypted) SSH credential — the phpseclib fleet path pins via TOFU but the sidecar did not. The resolve endpoint now returns the server's TOFU-pinned host key; the sidecar verifies the presented key against it (crypto.timingSafeEqual) during the handshake, before any credential is sent. parseHostKeyPin distinguishes three states so a corrupted record can't silently unpin: null → no pin (Clusev host / never-contacted server) → accept, TOFU first use false → a pin is present but malformed/undecodable → FAIL CLOSED (reject) Buffer → enforce the pin (reject a mismatch as MITM) Verified in-browser against a real server: valid key connects + runs; a swapped key is rejected as MITM; a garbage non-empty key fails closed — all before any credential leaves the sidecar. Full suite 469 pass; Codex re-review CLEAN. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| channels.php | ||
| console.php | ||
| web.php | ||