Repository navigation
fix(studio): a saved WiFi token goes only to the address it was saved for; any other address asks first - #754
Merged
Merged
Conversation
… for; any other address asks first Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NxVy8Kr2nZk8HoMNcxZPFF
…ith the same token, and word a token with no address as such Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NxVy8Kr2nZk8HoMNcxZPFF
jay23606
added a commit
to jay23606/flutter-probe
that referenced
this pull request
Nov 17, 2026
… for; any other address asks first (AlphaWaveSystems#754) ## Summary A saved WiFi token was looked up by the device's announced name, and any machine on the network can announce any name. Selecting a look-alike at another local address with the token field blank sent it the saved token (the 10.x/192.168.x check only refuses non-local addresses). - `SaveWiFiToken` binds the token to the address (host and port) of the WiFi connection that has just accepted it (a second keychain item per device). - `ConnectWiFiSaved` sends the token to that address as before. For any other address, and for a token with no address (saved before this change), it asks first, in the window: "Send the saved token?", naming the announced name, the address it would go to and the one the token was saved for. Cancel is focused, Enter does not press the send button, Escape is a no, and the send button is armed after half a second (the clear-data dialog's rules). No answer, no window (the headless bridge cannot answer), a timeout: all a no, and nothing is dialled. - A public address is refused before anyone is asked. After a confirmed connection the token is bound to the new address. Forgetting a token forgets its address; a new token with no connection to bind it to drops the old address. - The confirmation machinery is generalised (`askInWindow`, extracted from the clear-data path with no change in behaviour: its existing tests and the browser confirm-dialog specs pass). ## Tests and mutants Go, against a real fake agent: same address connects with no question; a spoofed name at another address is asked about with both addresses, a no dials nothing (the agent saw no ping), a yes connects and binds; no window and an unanswered question are a no; a legacy token asks once and is then bound; forget and replace drop the address; a public address is refused before the question; the question's text is cleaned; address spellings compare equal. 11 mutants killed: never ask, ask for a legacy token never, ask at the bound address, a no ignored, a public address asked about, an approved address not bound, a replaced token keeping the old address, forget keeping it, save not binding, case not folded, no window not a no. Node tests for the dialog copy. Not run in the real window yet: the dialog itself for this kind (the clear-data one has been, by hand). ## Docs CHANGELOG (Security), Studio docs (Physical devices). The CLI keeps no saved tokens, so the CLI docs are unchanged. ## Test plan - [x] `go test -race ./studio` (whole package) - [x] `npm run test:confirm`, `test:wifi`; browser confirm-dialog specs (10 passed) - [x] mutants as above - [x] disclosure scan ## Review fixes - The address that is compared is the address that is dialled: `ConnectWiFiSaved` normalises the host (no brackets, no trailing dot, no surrounding space, lower case) and dials that, so `127.0.0.1.` can no longer compare equal to the bound address yet be resolved as a name. - A confirmed connection that fails binds nothing; the bind happens only if the token saved now is still the one this connection used. - A token saved with no address is asked about as "saved without an address"; DOM specs cd-11 and cd-12 cover the new dialog kind (focus on Cancel, Enter on Send token does nothing, armed after half a second, Escape a no). - Mutants added: the raw host dialled, one round of trimming, no lower-casing, a failed connection binding, no generation check, an approved address never bound: all killed.
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
A saved WiFi token was looked up by the device's announced name, and any machine on the network can announce any name. Selecting a look-alike at another local address with the token field blank sent it the saved token (the 10.x/192.168.x check only refuses non-local addresses).
SaveWiFiTokenbinds the token to the address (host and port) of the WiFi connection that has just accepted it (a second keychain item per device).ConnectWiFiSavedsends the token to that address as before. For any other address, and for a token with no address (saved before this change), it asks first, in the window: "Send the saved token?", naming the announced name, the address it would go to and the one the token was saved for. Cancel is focused, Enter does not press the send button, Escape is a no, and the send button is armed after half a second (the clear-data dialog's rules). No answer, no window (the headless bridge cannot answer), a timeout: all a no, and nothing is dialled.askInWindow, extracted from the clear-data path with no change in behaviour: its existing tests and the browser confirm-dialog specs pass).Tests and mutants
Go, against a real fake agent: same address connects with no question; a spoofed name at another address is asked about with both addresses, a no dials nothing (the agent saw no ping), a yes connects and binds; no window and an unanswered question are a no; a legacy token asks once and is then bound; forget and replace drop the address; a public address is refused before the question; the question's text is cleaned; address spellings compare equal. 11 mutants killed: never ask, ask for a legacy token never, ask at the bound address, a no ignored, a public address asked about, an approved address not bound, a replaced token keeping the old address, forget keeping it, save not binding, case not folded, no window not a no. Node tests for the dialog copy.
Not run in the real window yet: the dialog itself for this kind (the clear-data one has been, by hand).
Docs
CHANGELOG (Security), Studio docs (Physical devices). The CLI keeps no saved tokens, so the CLI docs are unchanged.
Test plan
go test -race ./studio(whole package)npm run test:confirm,test:wifi; browser confirm-dialog specs (10 passed)🤖 Generated with Claude Code
https://claude.ai/code/session_01NxVy8Kr2nZk8HoMNcxZPFF
Review fixes
ConnectWiFiSavednormalises the host (no brackets, no trailing dot, no surrounding space, lower case) and dials that, so127.0.0.1.can no longer compare equal to the bound address yet be resolved as a name.