Skip to content

chore: add more test coverage#142

Merged
kruton merged 1 commit into
mainfrom
more-testing
May 9, 2026
Merged

chore: add more test coverage#142
kruton merged 1 commit into
mainfrom
more-testing

Conversation

@kruton
Copy link
Copy Markdown
Member

@kruton kruton commented May 9, 2026

Add test coverage for EXT_INFO and keystroke obfuscation. This will kill some mutations discovered by pitest.

Copilot AI review requested due to automatic review settings May 9, 2026 09:47
@kruton kruton force-pushed the more-testing branch 2 times, most recently from 1a2aa08 to 9bc822c Compare May 9, 2026 09:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 KeystrokeObfuscator unit tests with boundary/edge-case scenarios.
  • Extends FakeSshServer test harness to capture the client’s initial SSH_MSG_KEXINIT for 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.

Comment thread sshlib/src/test/kotlin/org/connectbot/sshlib/client/KeystrokeObfuscatorTest.kt Outdated
Comment thread sshlib/src/test/kotlin/org/connectbot/sshlib/client/KeystrokeObfuscatorTest.kt Outdated
Comment on lines +233 to +240
@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)
Comment thread sshlib/src/test/kotlin/org/connectbot/sshlib/client/ExtInfoNegotiationTest.kt Outdated
Comment on lines +394 to +399
// 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 {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 9e307e9 — replaced the two yield() calls with advanceUntilIdle() to drain the test scheduler before asserting serverSigAlgs remains null.

Copy link
Copy Markdown

Copilot AI commented May 9, 2026

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:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of kruton May 9, 2026 10:01
Add test coverage for EXT_INFO and keystroke obfuscation. This will
kill some mutations discovered by pitest.
@kruton kruton merged commit 43409eb into main May 9, 2026
12 checks passed
@kruton kruton deleted the more-testing branch May 9, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants