Uh oh!
There was an error while loading. Please reload this page.
fix: cap electrum probe response lines - #1198
Merged
Merged
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Greptile SummaryThe PR replaces the Electrum probe’s unbounded response-line read with a 16 KiB byte-capped reader, converting oversized or incomplete responses into the existing probe-failure path.
Confidence Score: 5/5The PR appears safe to merge, with no concrete correctness, security, or test-lifecycle defect identified. The bounded reader stops retaining bytes beyond the configured limit, preserves bytes for sequential requests, handles normal newline framing, and routes malformed responses through the existing NotElectrum result.
|
| Filename | Overview |
|---|---|
| app/src/main/java/to/bitkit/services/ElectrumProbeService.kt | Introduces a bounded byte-level response reader while preserving sequential JSON-RPC framing and existing probe error handling. |
| app/src/test/java/to/bitkit/services/ElectrumProbeServiceTest.kt | Adds deterministic loopback coverage proving oversized response lines are rejected with the configured cap in the cause. |
| changelog.d/next/electrum-probe.security.md | Accurately records that oversized custom-server responses no longer crash the application. |
Reviews (1): Last reviewed commit: "chore: add electrum probe changelog frag..." | Re-trigger Greptile
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR caps Electrum probe response lines so a user-supplied endpoint cannot grow
readLine()until the process OOMs.Follow-up to the Greptile note on #1174: #1174 (comment)
We left it off the 2.4.1 hotfix on purpose. The risk is a local crash after the user taps Connect on an Electrum URL they typed or scanned — not remote, not funds, not unlock.
soTimeoutalready covers a silent peer. This only bounds the remaining “stream bytes without a newline” case before the next store build.Description
readLine()in the Electrum probe with a 16 KiB byte-capped line readNotElectrum, same as any other failed handshakePreview
N/A
QA Notes
Manual Tests
regression:Settings → Electrum → Connect to a closed or non-Electrum port: still rejected, wallet stays up.Automated Checks
ElectrumProbeServiceTest.kt.Made with Cursor