Support Intent Firewall rule writing via system-UID Shizuku (#1547) - #1550
Open
lihenggui wants to merge 10 commits into
Open
Support Intent Firewall rule writing via system-UID Shizuku (#1547)#1550lihenggui wants to merge 10 commits into
lihenggui wants to merge 10 commits into
Conversation
…mode IFW - Create ShizukuIfwModule binding RoutingIfwFileSystem (unqualified IfwFileSystem), ShizukuIfwFileSystem (@ShizukuIfwFs), RootOrShizukuIfwAccessChecker, and RealShizukuPrivilegeProvider (Task 8 Step 3). - IfwModule: qualify LibrootIfwFileSystem under @RootIfwFs and switch providesIntentFirewall to inject IfwAccessChecker (Task 8 Step 1). - IntentFirewall: replace RootAvailabilityChecker with IfwAccessChecker; all gates now use isIfwWritable() (Task 8 Step 2). - Add FakeIfwAccessChecker test double; update IntentFirewall tests. - ShizukuIfwFileSystem: add bind timeout and unbind the UserService on disconnect/timeout/cancellation to prevent binding leaks. - BlockerApp: add SYSTEM_USER info hint; add system/ifw privilege strings (Task 9).
Code-review/CI fixes: - IfwFileOps.restorecon: HiddenApiBypass.invoke is @RequiresApi(28) but the module minSdk is 23 (lint NewApi error). Guard it behind SDK_INT>=P and use plain reflection below 28 where no hidden-API blacklist exists. - Remove unused string ifw_requires_privilege_hint (UnusedResources risk); the SHELL_USER+IFW-specific hint needs controller-type plumbing, deferred.
| try { | ||
| // android.os.SELinux.restorecon(String) is @hide. The hidden-API blacklist only | ||
| // exists on API 28+, so use HiddenApiBypass there and plain reflection below it. | ||
| val selinux = Class.forName("android.os.SELinux") |
| <string name="firewall">Firewall</string> | ||
| <string name="no_permission_hint">Unable to obtain permission, the application may not function properly.</string> | ||
| <string name="shell_permission_hint">Granted shell permission. Controlling components may not function properly.</string> | ||
| <string name="system_permission_hint">Running in system mode (UID 1000). Intent Firewall is available.</string> |
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.
Closes #1547
The IFW layer already hides privileged file access behind the
IfwFileSysteminterface (read/write/delete/exists/list), previously bound only to the librootkotlinx (su) implementation. This PR adds a second implementation that performs the same file I/O inside a Shizuku UserService running at the elevated UID, plus a router that picks root-vs-Shizuku per call and a broadened access gate.Test Plan
./gradlew spotlessCheck --no-configuration-cache./gradlew :build-logic:convention:check./gradlew dependencyGuard./gradlew graphUpdate./gradlew verifyRoborazziFossDebug./gradlew testFossDebug :lint:test./gradlew :app-compose:lintMarketRelease :lint:lint./gradlew :app-compose:checkMarketReleaseBadging./gradlew :app-compose:assemble -PminifyWithR8=false