Repository navigation
fix(sync2): bound every response, live message and LAN frame read - #1652
Merged
1 commit merged intoNov 2, 2026
Merged
1 commit merged into
1 commit merged into
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
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 free
to 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.
Summary
Bounds every read from a store or peer (spec/store.md "Untrusted input", Flow-Tube/flow-sync#75):
ResponseBody.bytesUpTo(limit)reads through OkHttp's source and fails past the limit. Objects, blobs and keys 4 MiB; JSON, mailbox messages and WebDAV listings 16 MiB. This also boundsGroupStore.downloadandFileLayoutbefore anything reaches disk.sync/transport/BoundedListenercancels the socket on a message over 64 KiB (OkHttp 5.4 has no inbound size setting).WsServersets KtormaxFrameSizeandWsClientusesBoundedListener; both default to unlimited, so FLOW-SYNC/1 is unchanged, and v2 LAN sync and pairing pass 4 MiB + 1/16.LanLink.receiverefuses content over 4 MiB, as Flow Desktop does.Inbound channels stay unbounded: backpressure would stall ping handling and kill busy sockets, and each message is now bounded.
Related issue
Change type
Validation
./gradlew :app:assembleGithubDebug: not run on this branch; CI builds the APK./gradlew --offline :app:testGithubDebugUnitTest --tests 'io.github.aedev.flow.sync2.*' --tests 'io.github.aedev.flow.sync.*': 160 sync2 and 166 sync tests (162 + 4 new transport tests), 0 failures. New:ServerStoreTestandWebDavStoreTest.answers_past_their_limit_are_refused(4 MiB accepted, 4 MiB + 1 and a 16 MiB+ JSON body refused),LanLinkTest,BoundedListenerTest(2),WsServerTest,WsClientTest. Before: the store tests failed withAssertionError./gradlew --offline ktlintCheck: passedTest device and Android version: not device-tested yet
Risk and compatibility
Nightly note added. A LAN
getanswer with a full 4 MiB object plus its header line is over the frame payload limit (on Flow Desktop too); objects that large are rare, and the spec's frame limit needs a clarification for it.