diff options
| author | 2021-08-19 19:40:36 +0000 | |
|---|---|---|
| committer | 2021-08-19 19:40:36 +0000 | |
| commit | 03fee5a3be9928926abd7aca8dd6cf15c67f6680 (patch) | |
| tree | 40a3a059df9c266ba3837eb8fcc309ab0b35fd5d | |
| parent | ca1132c55d872945268ed335c580626a96f359ee (diff) | |
| parent | 464d03f2ff0aad36ee69bd6e2c27111c549f92f3 (diff) | |
Merge "Prevend user spoofing in isRequestPinItemSupported" into sc-dev am: 11f6a1013f am: 464d03f2ff
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15340830
Change-Id: I0e4d5596230a427b4c6e4f183be19a6fb61d5b67
| -rw-r--r-- | services/core/java/com/android/server/pm/ShortcutService.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/pm/ShortcutService.java b/services/core/java/com/android/server/pm/ShortcutService.java index fcbf40e29933..62d6717e847a 100644 --- a/services/core/java/com/android/server/pm/ShortcutService.java +++ b/services/core/java/com/android/server/pm/ShortcutService.java @@ -1664,6 +1664,19 @@ public class ShortcutService extends IShortcutService.Stub { mContext.enforceCallingPermission(permission, message); } + private void verifyCallerUserId(@UserIdInt int userId) { + if (isCallerSystem()) { + return; // no check + } + + final int callingUid = injectBinderCallingUid(); + + // Otherwise, make sure the arguments are valid. + if (UserHandle.getUserId(callingUid) != userId) { + throw new SecurityException("Invalid user-ID"); + } + } + private void verifyCaller(@NonNull String packageName, @UserIdInt int userId) { Preconditions.checkStringNotEmpty(packageName, "packageName"); @@ -2847,6 +2860,8 @@ public class ShortcutService extends IShortcutService.Stub { @Override public boolean isRequestPinItemSupported(int callingUserId, int requestType) { + verifyCallerUserId(callingUserId); + final long token = injectClearCallingIdentity(); try { return mShortcutRequestPinProcessor |