Repository navigation
Follow the spec when refusing a pairing activation - #223
Merged
Merged
Conversation
A Sentinel session with unpaired access off that got playback plus pairing with method pairing_psk closed with pairing_required instead of unauthorized. An activation refused with pair/abort method_not_supported still applied its activities and active_roles, and a pairing activation without a method could get pairing_required instead of a silent close.
There was a problem hiding this comment.
🟡 Changes recommended
A critical re-handshake authorization flaw retains prior roles after pairing refusal, allowing queued commands and reporting to resume despite the new connection not permitting playback.
1 open issue
What changed in this PR
This PR aligns pairing-activation refusal handling with the Sendspin specification, validating pairing methods and formats before applying activation state.
Changes:
- Centralizes pairing validation alongside activation authorization.
- Separates refused activations from accepted state updates and adds reporting resumption.
- Expands regression coverage for refusal reasons, malformed activations, and re-handshake behavior.
| File | Description |
|---|---|
| tests/unit/transport-rehandshake.test.ts | Tests refusal handling, retained roles, and queued commands. |
| tests/unit/transport-harness.ts | Adds pairing-method offers and a refusal callback. |
| tests/unit/transport-activate.test.ts | Tests silent closure when the pairing method is missing. |
| tests/unit/protocol-handler.test.ts | Tests reporting resumption with retained roles. |
| tests/unit/pairing.test.ts | Updates refusal and pairing-index tests after validation moves. |
| tests/unit/core-encryption.test.ts | Tests reporting resumption after a refused re-handshake activation. |
| tests/unit/activate-authorization.test.ts | Expands pairing authorization and error-precedence coverage. |
| src/core/transport.ts | Handles authorization outcomes before applying activation state. |
| src/core/protocol-handler.ts | Adds reporting resumption without replacing roles. |
| src/core/pairing.ts | Moves validation out and adds refused-attempt handling. |
| src/core/core.ts | Wires pairing offers and activation-refusal callbacks. |
| src/core/activate-authorization.ts | Centralizes pairing-method, format, and activation checks. |
Review effort: Balanced
33 tasks done
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.

What does this implement/fix?
When a server activated pairing with a method the client doesn't allow, the client could close with
pairing_requiredinstead ofunauthorized, which told the server to pair first even though pairing couldn't help. An activation the client refused withpair/abortmethod_not_supportedalso still applied its activities andactive_roles, and a pairing activation missing its method could getpairing_requiredinstead of closing without a message.These only happen with a non-compliant server. The pairing method and format are now checked together with the other activation rules, in the order the spec gives.
Related issue or spec PR (if applicable):
Types of changes
bugfixnew-featureenhancementbreaking-changerefactordocumentationmaintenancecidependencies