request ACCESS_LOCAL_NETWORK when enabling open proxy on all interfaces#1748
Merged
bitmold merged 7 commits intoJul 6, 2026
Merged
Conversation
meenbeese
reviewed
Jul 5, 2026
…es on Android 17+ the open proxy on all interfaces setting binds the SOCKS proxy to 0.0.0.0, which needs ACCESS_LOCAL_NETWORK on Android 17. we only asked for that permission in kindness mode, so toggling this setting on API 37+ silently produced a proxy nothing on the LAN could reach. moved the permission check out of UPnPDialogFragment into NetworkUtils so both kindness mode and the settings screen share it. the settings toggle now requests the permission before committing, same grant/deny/repeated-denial flow as the kindness dialog. TorConfig also falls back to a localhost-only SOCKSPort if the pref is on but the permission isn't, so a revoked grant can't leave the proxy silently unreachable. fixes guardianproject#1743
bitmold
force-pushed
the
fix-lan-permission-request
branch
from
July 6, 2026 17:12
503bc3c to
c57d730
Compare
Collaborator
|
Rebased with |
A Toast didnt display the whole text, and doesn't explain the immediate prompting of the vague "Access Nearby Devices" system permission dialog
of duplicating it across UPnPFragment+SettingsPrefFragment, etc
on all interfaces from TorConfig.kt to Prefs
revoked the permission outside of the app.
Collaborator
|
@munzzyy Thank you so much for implementing this and for making your first contribution to Orbot! This was a very high quality PR and I'm very grateful for it. ⭐ Normally, I'd ask you to make some changes to this PR and provide feedback, but since we have a release coming out very soon - I made them myself. All of your core logic was solid, but I made the following changes/refactors:
I'm definitely open to any future improvements around this if you have further suggestions/opinions. Thanks again for making Orbot better ❤️ |
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.
Fixes #1743
The "Open Proxy on All Interfaces" setting makes Tor bind its SOCKS port to
0.0.0.0(TorConfig.kt), which on Android 17 needs theACCESS_LOCAL_NETWORKpermission. Right now we only ever request that permission from the kindness mode UPnP dialog, so flipping this setting on an API 37 device just produces a proxy that nothing on the LAN can actually reach - no prompt, no error, it just doesn't work.What this does:
needsAccessLocalNetworkPermission()out ofUPnPDialogFragmentand intoNetworkUtils, so it's shared instead of duplicated.UPnPDialogFragmentandSnowflakeProxyWrappernow call the shared version.SettingsPreferenceFragmentnow hooks the "Open Proxy on All Interfaces" checkbox: turning it on triggers a permission request first (same grant / deny / "permanently denied -> app settings" flow the kindness dialog already uses), and the checkbox only gets checked once the permission is actually granted.TorConfig.build()falls back to a localhost-onlySOCKSPortif the preference is on but the permission isn't (e.g. revoked after the fact in system settings), so we never emit a0.0.0.0config nothing can reach.Verified by reading through the existing kindness-mode permission flow and mirroring it exactly, and by checking every call site of the old
UPnPDialogFragment.needsAccessLocalNetworkPermission(there were two: the dialog itself andSnowflakeProxyWrapper) to make sure both got updated. I don't have a Java/Gradle toolchain in this environment so I couldn't build or run this - I'd appreciate someone testing the actual permission dialog on an API 37 emulator/device before merge. I also haven't tested the LAN end-to-end (a second device actually connecting through the opened proxy), just that the config and permission flow line up.