Repository navigation
fix(wda): listen on the phone's loopback only - #180
Merged
Merged
Conversation
WDA was launched in the background with an empty environment, and without USE_IP it listens on every interface of the phone: with the phone on Wi-Fi, anyone on the network could drive it through port 8100 (no authentication) and watch it on 9100. Launch it (and the debug XCTest runner) with USE_IP=127.0.0.1; usbmuxd's connections arrive on the phone's loopback. A background WDA an older version launched is no longer attached to but launched again once: state.json records loopback-only ones (loopback_wdas). Co-Authored-By: Claude Opus 5.5 <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.
What and why
WDA was launched in the background with an empty environment (
Tunnel::launch_in_background), and withoutUSE_IPit listens on every interface of the phone. With the phone on Wi-Fi, anyone on the network could drive it through port 8100 (plain HTTP, no authentication) and watch it on 9100 (MJPEG). This is independent of the planned Wi-Fi control (docs/dev/wifi.md§4.2) and is fixed on its own.USE_IP=127.0.0.1(ictl_wda::runner::WDA_BIND_IP/launch_env()), in the background and by thedebugXCTest runner. usbmuxd's connections arrive on the phone's loopback, so the daemon,wda-bridgeand the viewer still reach it.state.jsongainsloopback_wdas(serde default, omitted when empty), andPersisted::adoptable_foronly returns a WDA recorded there. Older versions keep readingdetached_wdas; a WDA they launch gets a new pid, so it isn't adopted by this version either. The event log says why it is relaunched.docs/dev/wifi.md.Tests
1. Unit tests
the_launch_environment_is_a_dictionary_of_strings(ictl-device),only_a_loopback_only_background_wda_is_attached_to_again(ictl-daemon); existingeach_device_keeps_its_background_wda,an_older_versions_background_wda_is_still_knownstill passcargo clippy --workspace --all-targets --all-features --locked -- -D warningsandcargo test --workspace --all-features --lockedpass locally#[ignore]tests of the changed area run by hand: none apply2. Real-device regression
iPhone 18 Pro Max (iPhone19,7, iOS 27.2.1) on USB, macOS host, forced onto WDA with
ICTL_IOS_BACKEND=wda(iOS 27 drives natively by default and doesn't use WDA). WDA on the phone reports build 16.15.2.USE_IP)curl http://<phone Wi-Fi IP>:8100/statusfrom the host over the networkcurl http://<phone Wi-Fi IP>:9100//statusover usbmuxd (wda-bridge)HTTP/1.0 200 OK, 3 JPEG frames in 8 sloopback_wdasrecordedpress_button home,tap_element 设置,list_elements, WDA screenshot all workCaveat: the network probe ran from the host itself against the phone's Wi-Fi address (not from a second machine on the LAN); the route went through the host's network, not usbmuxd.
3. Regression cases (docs/dev/regression-cases.md)
🤖 Generated with Claude Code