Align with LocalSend 1.18: present the client certificate, protocol 2.2 - #1
Open
AlexDevFlow wants to merge 1 commit into
Open
Align with LocalSend 1.18: present the client certificate, protocol 2.2#1AlexDevFlow wants to merge 1 commit into
AlexDevFlow wants to merge 1 commit into
Conversation
LocalSend 1.18 requires a client certificate on its HTTPS server whenever it is not serving its web pages, which is the normal receive state. lsq built its discovery HTTP client without an identity, so its reply to an announcement died in the handshake with a CertificateRequired alert and the peer never learned lsq existed. Discovery, presence announcements and pull now all present the certificate, the way the official client does on every request. Bump the protocol to 2.2 and answer a checksum mismatch with 422 instead of 500: that status is the one thing 2.2 adds, and it is what the official server returns. Protocol v3 is deliberately not implemented. 1.18.2 routes only /v3/nonce and /v3/register, its v3 register handler is a stub marked "not wired up yet", and the app pins its own HTTP client to v2. Devices still announce 2.2 and still transfer over the v2 endpoints, so there is nothing live to talk to on v3. Checked against the LocalSend 1.18.2 core in both directions, with the files arriving byte-identical. tests/mtls.rs is a self-contained regression guard: it stands up a server that demands a client certificate and asserts that a certless client is refused and lsq's identity client gets through. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Why
LocalSend 1.18 requires a client certificate on its HTTPS server whenever it is not serving its web pages — which is the normal receive state. lsq built its discovery HTTP client without an identity, so its reply to an announcement died in the handshake:
The peer therefore never learned lsq existed, except by chance from lsq's own next announcement.
What changed
discovery::discover,announce_presence, andpull_filesnow take the identity instead of using a certless client.tests/mtls.rs: a self-contained regression guard that stands up a server demanding a client certificate, asserting the certless client is refused and the identity client gets through. No LocalSend checkout needed.On protocol v3
Deliberately not implemented — it is scaffolding, not a live protocol:
v3/; its README is still v2.2 and the CHANGELOG stops at 2.2./v3/nonceand/v3/register. There is no v3prepare-upload,upload,cancelorpair, andv3::registeris a stub marked// TODO: not wired up yet.LsHttpClientVersion.v2at both construction sites;"3.0"appears nowhere in the repo, and devices announce2.2.Worth revisiting when the app starts using it.
Verification
Checked against the real LocalSend 1.18.2 core (
packages/core) in both directions:lsq receiveCertificateRequired(the bug)Plus the full lsq suite and
cargo clippy --all-targets -- -D warnings.Three tests (
session_is_bound_to_ip,cancel_from_other_ip_is_ignored,upload_from_different_ip_is_403) fail on macOS both before and after this change: they bind a127.0.0.2source address, which Linux aliases automatically and macOS does not. They pass in CI. Left alone here.🤖 Generated with Claude Code