Repository navigation
Cap client-sent text fields in UTF-8 bytes - #329
Merged
Merged
Conversation
11 of 12 tasks
1 of 9 tasks
maximmaxim345
added a commit
to Sendspin/aiosendspin
that referenced
this pull request
Nov 2, 2026
# What does this implement/fix? <!-- Quick description and explanation of changes. --> Fixes several server-side pairing edge cases. - Lenient servers now also refuse a pairing method that `client/hello` didn't list, before sending the activation. Before, they sent it and let the client abort. A client that offered both pairing code methods can still pair with the static code, now also on strict servers. - Retrying pairing no longer fails right away when a late `pair/abort` with `attempt_timeout` or `pairing_code_mismatch` from the previous attempt arrives. - The `client/pair-pending` message is now capped at 200 bytes in UTF-8 instead of 200 characters. - A pairing frame with no pairing `server/activate` since the handshake, an explicit null for `locations`, and a `pairing_index` below 1 are now flagged as noncompliant. **Related issue or spec PR (if applicable):** - Sendspin/spec#329 ## Types of changes <!-- Tick exactly one box. CI (.github/workflows/pr-labels.yaml) applies the matching label, and the release notes use it to sort this change. --> - [x] Bugfix (non-breaking change which fixes an issue): `bugfix` - [ ] New feature (non-breaking change which adds functionality): `new-feature` - [ ] Enhancement to an existing feature: `enhancement` - [ ] Breaking change (changes the public API or the protocol in a way that is not backwards compatible): `breaking-change` - [ ] Refactor (no behavior change): `refactor` - [ ] Documentation only: `documentation` - [ ] Maintenance / chore: `maintenance` - [ ] CI / workflow change: `ci` - [ ] Dependencies bump: `dependencies`
1 task done
maximmaxim345
pushed a commit
that referenced
this pull request
Nov 3, 2026
<!-- Describe the change and why it is needed. --> #329 capped the text fields a client sends in `client/hello`. The server sends two friendly names that the client stores and shows: `name` in `server/hello` and `group_name` in `group/update`. Neither has a length limit. This caps both at 64 bytes in UTF-8, so a client can hold them in fixed storage instead of an allocation whose size the server controls. 64 bytes matches the client-side caps from #329, which follow Matter's 64-byte version strings and UPnP's friendly-name guidance. The cap counts bytes, not characters, so both sides count the same way. A client that receives a longer value truncates it at a UTF-8 character boundary instead of closing the connection. The server would send the same name again on every reconnect, so closing would leave the client disconnecting over and over, with nothing to show the user that a name is the cause. A `group_name` the server didn't check would disconnect every client in the group. This matches the `client/pair-pending` `message`, the one other display string with a cap, where the receiver truncates. The server's mDNS TXT `name` is not capped, matching #329's handling of the client's TXT `name`. It SHOULD match the `server/hello` `name` and is only a discovery hint. - [x] I accept the [Contributor License Agreement](../blob/main/CONTRIBUTOR-LICENSE-AGREEMENT.md) for this contribution.
1 of 9 tasks
maximmaxim345
added a commit
to Sendspin/aiosendspin
that referenced
this pull request
Nov 5, 2026
# What does this implement/fix? <!-- Quick description and explanation of changes. --> The client SDK counted `PairingSupport.pair_pending_message` in characters, but the spec caps the `client/pair-pending` message at 200 bytes in UTF-8. So a non-ASCII message could pass the SDK check and then be cut off or refused by the server. `PairingSupport` now raises `ValueError` for a message over 200 bytes in UTF-8, which is stricter than before for non-ASCII text. **Related issue or spec PR (if applicable):** - Sendspin/spec#329 ## Types of changes <!-- Tick exactly one box. CI (.github/workflows/pr-labels.yaml) applies the matching label, and the release notes use it to sort this change. --> - [x] Bugfix (non-breaking change which fixes an issue): `bugfix` - [ ] New feature (non-breaking change which adds functionality): `new-feature` - [ ] Enhancement to an existing feature: `enhancement` - [ ] Breaking change (changes the public API or the protocol in a way that is not backwards compatible): `breaking-change` - [ ] Refactor (no behavior change): `refactor` - [ ] Documentation only: `documentation` - [ ] Maintenance / chore: `maintenance` - [ ] CI / workflow change: `ci` - [ ] Dependencies bump: `dependencies`
1 of 9 tasks
maximmaxim345
added a commit
to Sendspin/aiosendspin
that referenced
this pull request
Nov 17, 2026
…624) # What does this implement/fix? <!-- Quick description and explanation of changes. --> The client SDK could send a `client/hello` name or `device_info` string over 64 UTF-8 bytes, or a `min_buffer_ms` up to 30000. Conforming servers close the connection on these, and an aiosendspin server in strict mode rejects the client. The client now cuts those strings to 64 bytes without splitting a character, and clamps `min_buffer_ms` to 0-5000. **Related issue or spec PR (if applicable):** - Sendspin/spec#313 - Sendspin/spec#329 - Sendspin/spec#347 ## Types of changes <!-- Tick exactly one box. CI (.github/workflows/pr-labels.yaml) applies the matching label, and the release notes use it to sort this change. --> - [x] Bugfix (non-breaking change which fixes an issue): `bugfix` - [ ] New feature (non-breaking change which adds functionality): `new-feature` - [ ] Enhancement to an existing feature: `enhancement` - [ ] Breaking change (changes the public API or the protocol in a way that is not backwards compatible): `breaking-change` - [ ] Refactor (no behavior change): `refactor` - [ ] Documentation only: `documentation` - [ ] Maintenance / chore: `maintenance` - [ ] CI / workflow change: `ci` - [ ] Dependencies bump: `dependencies`
53 of 58 tasks
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.
Any device on the network can put text of any length into
nameand thedevice_infostrings inclient/hellowithout pairing, and the server shows it to the operator in its device list.This caps each of them at 64 bytes in UTF-8, so a server can reject a client that sends more. I picked 64 bytes since Matter caps its version strings at 64 UTF-8 bytes, and UPnP recommends friendly and manufacturer names under 64 characters.
client/pair-pendingmessagewas capped at 200 characters with no unit, so a client and a server that count differently could disagree on a non-ASCII message. It now counts 200 bytes in UTF-8 as well.