Skip to content

Support Intent Firewall rule writing via system-UID Shizuku (#1547) - #1550

Open
lihenggui wants to merge 10 commits into
mainfrom
feat/shizuku-ifw
Open

Support Intent Firewall rule writing via system-UID Shizuku (#1547)#1550
lihenggui wants to merge 10 commits into
mainfrom
feat/shizuku-ifw

Conversation

@lihenggui

@lihenggui lihenggui commented Jun 20, 2026

Copy link
Copy Markdown
Owner

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

lihenggui added 10 commits June 14, 2026 21:08
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FR]: Add System UID (1000) / Shizuku-System Mode Support for Intent Firewall

2 participants