Repository navigation
Conversation
In v2.0.4, importing from clipboard accepted any non-empty string without verifying whether it constitutes a valid Android package name. If a URL or arbitrary text was in the clipboard, it was imported into DataStore.individual as an extra selected package. This caused sing-box's include_package rule to receive invalid package strings, while Android VpnService threw NameNotFoundException on openTun(), breaking VPN routing and leaving the selection corrupted. - Validate package names against AOSP package naming format (and allow framework "android") via PackageCache.isValidPackageName(). - Reject invalid clipboard payloads in AppManagerActivity and AppListActivity without overwriting existing user proxy configuration. - Automatically purge corrupt entries from DataStore.individual in initProxiedUids() and filter perAppPackages in SettingsMapper to prevent TUN startup failures. - Safeguard VpnService against unhandled OEM exceptions during addAllowedApplication. - Add unit tests verifying regex conformance, clipboard extraction, and config self-healing. Fixes throneproj#113
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
Fixes clipboard import in per-app proxy incorrectly parsing URLs and arbitrary text as application package names (#113).
Root Cause
In v2.0.4,
action_import_clipboardsplit clipboard content by newlines and saved lines directly intoDataStore.individualwithout verifying whether each string conforms to Android package naming rules. If a URL (e.g.https://www.gstatic.com/generate_204) was in the clipboard, it was saved as an extra uninstalled app and enabled. Upon starting the VPN:ConfigGeneratorincluded the URL intotun.include_package.VpnService.Builder.addAllowedApplication()threwPackageManager.NameNotFoundException, adding 0 apps to the OS tunnel builder (causing OS to route all apps into the tun).sing-boxdropped all packets because no traffic matched the non-existent URL package name, cutting off internet access.Solution
PackageCache.isValidPackageName()(requiring at least two dot-separated segments starting with ASCII letters, and allowing framework"android").AppManagerActivityandAppListActivity; abort and show error snackbar without overwriting stored configuration when no valid packages are present.AppManagerActivity.initProxiedUids()to automatically purge invalid legacy entries fromDataStore.individual.perAppPackagesinSettingsMapperto prevent invalid entries from reaching core configs.VpnService.addAllowedApplicationagainst OEM runtime exceptions.