OSDN Git Service

DO NOT MERGE. KEY_INTENT shouldn't grant permissions.
authorJeff Sharkey <jsharkey@android.com>
Mon, 12 Jun 2017 23:33:07 +0000 (17:33 -0600)
committerJeff Sharkey <jsharkey@google.com>
Tue, 3 Oct 2017 21:22:06 +0000 (21:22 +0000)
KEY_INTENT has no business granting any Uri permissions, so remove
any grant flags that malicious apps may have tried sneaking in.

Test: builds, boots
Bug: 3299034132879915
Change-Id: I657455a770c81f045ccce6abbd2291407a1cfb42

services/core/java/com/android/server/accounts/AccountManagerService.java

index cb6cb21..5a21046 100644 (file)
@@ -3860,6 +3860,10 @@ public class AccountManagerService
         protected void checkKeyIntent(
                 int authUid,
                 Intent intent) throws SecurityException {
+            intent.setFlags(intent.getFlags() & ~(Intent.FLAG_GRANT_READ_URI_PERMISSION
+                    | Intent.FLAG_GRANT_WRITE_URI_PERMISSION
+                    | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION
+                    | Intent.FLAG_GRANT_PREFIX_URI_PERMISSION));
             long bid = Binder.clearCallingIdentity();
             try {
                 PackageManager pm = mContext.getPackageManager();