Add per-app access control for remote automation - #6206
Open
eliotcougar wants to merge 9 commits into
Open
eliotcougar wants to merge 9 commits into
eliotcougar wants to merge 9 commits into
Conversation
eliotcougar
marked this pull request as ready for review
September 7, 2026 15:01
Owner
|
非常感谢 |
Contributor
Author
It's exactly backwards. The feature that is used by a small number of people makes everybody else vulnerable. It is extremely uncomfortable when an unrelated domestic app can have an update any moment that will make it possible to disable your VPN whenever it wants. And it already happens. Existing users who need automation will only have to check what automation apps can access v2rayNG. We can also try to preselect the most popular known automation apps to make the update more seamless. |
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.
Problem and motivation
The exported Locale/Tasker receiver currently accepts start/stop commands from other installed apps without authorization. An unrelated app can stop the user's VPN; it does not need to share v2rayNG's signing key.
There is also a separate configuration-import issue described in #6231: external shared text and install links can silently replace profiles in the default group and change the selected profile. This update protects that entry point with the same automation grants. The independent reproduction used harmless loopback profiles and verified replacement and selection changes, not live traffic interception.
I have received a confidential report that two government-affiliated apps in Russia already detect v2rayNG and send its stop command, disabling the user's VPN. The source cannot be disclosed. The independent reproduction verifies the exposed control mechanism, not the app-specific attribution.
Leaving this channel open makes it easy for more domestic apps to follow suit as they face government demands to restrict VPN users. RBC reported that the Ministry of Digital Development instructed major platforms to restrict access for users with active VPNs, with April 15, 2026 as the target date. This provides public context for the risk of wider adoption; it does not establish the reported stop-command behavior.
Changes
Activity.getCallingPackage()before loading profiles and before returning a capability. Preserve editor state, disable controls while loading, and distinguish a missing profile selection from denied authorization.getCallingPackage()for this operation: result forwarding can make the latter identify the result recipient rather than the sender.androidTestsources, or generated build artifacts are included.Compatibility
The public integration entry points remain exported so independently signed automation hosts can still use them. Making them private or requiring v2rayNG's signing key would break those integrations.
Users must allow their automation host, then reopen and save existing v2rayNG plugin actions to receive a capability. Legacy anonymous Send Intent broadcasts are rejected. Import clients can share their platform identity on API 34+ or supply the saved capability bundle; without authentication they take the confirmation-and-append path. Approved automation apps can still replace configurations for automated updates.
Saving a revocation invalidates the host's capabilities for both control and imports; granting access again issues a new token. Exporting a task containing a capability delegates that access, so hosts must treat it as a secret. VPN consent and Android background-execution restrictions still apply.
Validation
On
60908cee8::app:testPlaystoreDebugUnitTest: 105 tests passed, including 18 new import parser/ViewModel tests.:app:compilePlaystoreDebugKotlin,:app:assemblePlaystoreDebug -PABI_FILTERS=x86_64, and:app:assemblePlaystoreRelease -PABI_FILTERS=x86_64: passed.git diff --check: passed.The broader API 37 import checks covered untrusted shared text and install links, Cancel via keyboard/D-pad, confirmation across rotation, confirmed append preserving the selected profile, replacement by an independently signed allowed host, capability-based replacement without shared launcher identity, and forged/revoked capabilities falling back to confirmation. Only line wrapping and JVM-test synchronization changed afterward. Grant setup/revocation used the existing manager; the settings row and picker were opened, but their full interaction matrix was not repeated.
Earlier branch revisions also exercised API 33/API 37 start/stop authorization, capability issuance and revocation/regrant, invalid GUID rejection, backup exclusion, widgets, picker persistence, missing-profile editing, activity recreation, proxy-only start/stop, and MMKV serialization across four threads. Those earlier device scenarios were not all repeated on this revision.
Full
:app:lintPlaystoreDebugran before the final formatting/test-only adjustment and reported four unchanged upstreamNewApierrors inRootManager.kt,RootShell.kt, and the day/night themes. No findings referenced the new import files or strings. The final release build's lint-vital checks passed; full lint is not clean.Not run
Fixes #6231 Silent configuration import.