chore: add more test coverage#142
Conversation
1a2aa08 to
9bc822c
Compare
There was a problem hiding this comment.
Pull request overview
Adds additional unit/integration test coverage around SSH EXT_INFO negotiation and the keystroke obfuscation timing algorithm, targeting mutation survivors from PIT.
Changes:
- Expands
KeystrokeObfuscatorunit tests with boundary/edge-case scenarios. - Extends
FakeSshServertest harness to capture the client’s initialSSH_MSG_KEXINITfor assertions. - Adds new EXT_INFO negotiation tests covering kex algorithm list handling and EXT_INFO send/receive guards.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| sshlib/src/test/kotlin/org/connectbot/sshlib/client/KeystrokeObfuscatorTest.kt | Adds multiple boundary/edge-case tests for delay/interval/fuzz/session behavior. |
| sshlib/src/test/kotlin/org/connectbot/sshlib/client/FakeSshServer.kt | Captures and exposes the client’s initial KEXINIT to support negotiation assertions. |
| sshlib/src/test/kotlin/org/connectbot/sshlib/client/ExtInfoNegotiationTest.kt | Adds tests for ext-info-c handling in KEXINIT and EXT_INFO send/ignore behavior across rekeys/auth. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @Test | ||
| fun `interval close to Long MAX does not overflow fuzz computation`() { | ||
| // Int.MAX_VALUE cap prevents fuzz from exceeding random's int range | ||
| val hugeInterval = Int.MAX_VALUE.toLong() * 100L | ||
| var now = 0L | ||
| val obfuscator = KeystrokeObfuscator(hugeInterval, clockMs = { now }, random = Random(0)) | ||
| obfuscator.recordKeystroke() | ||
| assertTrue(obfuscator.nextIntervalMs() >= 1L) |
| // Send a rogue EXT_INFO even though server never advertised ext-info-s | ||
| server.sendCustomExtInfo(mapOf("server-sig-algs" to "ssh-ed25519".toByteArray(Charsets.US_ASCII))) | ||
| yield() | ||
| yield() | ||
| assertNull(serverSigAlgs(connection), "server-sig-algs must remain null when EXT_INFO is ignored") | ||
| } finally { |
There was a problem hiding this comment.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Done in 9e307e9 — replaced the two yield() calls with advanceUntilIdle() to drain the test scheduler before asserting serverSigAlgs remains null.
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Add test coverage for EXT_INFO and keystroke obfuscation. This will kill some mutations discovered by pitest.
Add test coverage for EXT_INFO and keystroke obfuscation. This will kill some mutations discovered by pitest.