Skip to content

Commit 094cf26

Browse files
committed
Merge tag 'android-security-13.0.0_r11' into HEAD
Android security 13.0.0 release 11 Change-Id: Icdf9a182d3d360357cb1316b475b48f6ce8c3b5c
2 parents 03d668d + 51640ed commit 094cf26

6 files changed

Lines changed: 72 additions & 8 deletions

File tree

core/java/android/app/Notification.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3404,8 +3404,11 @@ public void setLatestEventInfo(Context context,
34043404
*
34053405
* @hide
34063406
*/
3407-
public void setAllowlistToken(@Nullable IBinder token) {
3408-
mAllowlistToken = token;
3407+
public void clearAllowlistToken() {
3408+
mAllowlistToken = null;
3409+
if (publicVersion != null) {
3410+
publicVersion.clearAllowlistToken();
3411+
}
34093412
}
34103413

34113414
/**

core/java/android/hardware/usb/UsbConfiguration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ public UsbConfiguration createFromParcel(Parcel in) {
172172
String name = in.readString();
173173
int attributes = in.readInt();
174174
int maxPower = in.readInt();
175-
Parcelable[] interfaces = in.readParcelableArray(UsbInterface.class.getClassLoader());
175+
Parcelable[] interfaces = in.readParcelableArray(
176+
UsbInterface.class.getClassLoader(), UsbInterface.class);
176177
UsbConfiguration configuration = new UsbConfiguration(id, name, attributes, maxPower);
177178
configuration.setInterfaces(interfaces);
178179
return configuration;

packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,6 +1933,9 @@ private boolean mutateSystemSetting(String name, String value, int runAsUserId,
19331933
cacheName = Settings.System.ALARM_ALERT_CACHE;
19341934
}
19351935
if (cacheName != null) {
1936+
if (!isValidAudioUri(name, value)) {
1937+
return false;
1938+
}
19361939
final File cacheFile = new File(
19371940
getRingtoneCacheDir(owningUserId), cacheName);
19381941
cacheFile.delete();
@@ -1965,6 +1968,34 @@ private boolean mutateSystemSetting(String name, String value, int runAsUserId,
19651968
}
19661969
}
19671970

1971+
private boolean isValidAudioUri(String name, String uri) {
1972+
if (uri != null) {
1973+
Uri audioUri = Uri.parse(uri);
1974+
if (Settings.AUTHORITY.equals(
1975+
ContentProvider.getAuthorityWithoutUserId(audioUri.getAuthority()))) {
1976+
// Don't accept setting the default uri to self-referential URIs like
1977+
// Settings.System.DEFAULT_RINGTONE_URI, which is an alias to the value of this
1978+
// setting.
1979+
return false;
1980+
}
1981+
final String mimeType = getContext().getContentResolver().getType(audioUri);
1982+
if (mimeType == null) {
1983+
Slog.e(LOG_TAG,
1984+
"mutateSystemSetting for setting: " + name + " URI: " + audioUri
1985+
+ " ignored: failure to find mimeType (no access from this context?)");
1986+
return false;
1987+
}
1988+
if (!(mimeType.startsWith("audio/") || mimeType.equals("application/ogg")
1989+
|| mimeType.equals("application/x-flac"))) {
1990+
Slog.e(LOG_TAG,
1991+
"mutateSystemSetting for setting: " + name + " URI: " + audioUri
1992+
+ " ignored: associated mimeType: " + mimeType + " is not an audio type");
1993+
return false;
1994+
}
1995+
}
1996+
return true;
1997+
}
1998+
19681999
private boolean hasWriteSecureSettingsPermission() {
19692000
// Write secure settings is a more protected permission. If caller has it we are good.
19702001
return getContext().checkCallingOrSelfPermission(Manifest.permission.WRITE_SECURE_SETTINGS)

services/core/java/com/android/server/am/ActivityManagerService.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3024,6 +3024,22 @@ private void enforceAllowedToStartOrBindServiceIfSdkSandbox(Intent intent) {
30243024
}
30253025
}
30263026

3027+
/**
3028+
* Enforces that the uid of the caller matches the uid of the package.
3029+
*
3030+
* @param packageName the name of the package to match uid against.
3031+
* @param callingUid the uid of the caller.
3032+
* @throws SecurityException if the calling uid doesn't match uid of the package.
3033+
*/
3034+
private void enforceCallingPackage(String packageName, int callingUid) {
3035+
final int userId = UserHandle.getUserId(callingUid);
3036+
final int packageUid = getPackageManagerInternal().getPackageUid(packageName,
3037+
/*flags=*/ 0, userId);
3038+
if (packageUid != callingUid) {
3039+
throw new SecurityException(packageName + " does not belong to uid " + callingUid);
3040+
}
3041+
}
3042+
30273043
@Override
30283044
public void setPackageScreenCompatMode(String packageName, int mode) {
30293045
mActivityTaskManager.setPackageScreenCompatMode(packageName, mode);
@@ -12994,13 +13010,16 @@ private void clearPendingBackup(int userId) {
1299413010
// A backup agent has just come up
1299513011
@Override
1299613012
public void backupAgentCreated(String agentPackageName, IBinder agent, int userId) {
13013+
final int callingUid = Binder.getCallingUid();
13014+
enforceCallingPackage(agentPackageName, callingUid);
13015+
1299713016
// Resolve the target user id and enforce permissions.
12998-
userId = mUserController.handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(),
13017+
userId = mUserController.handleIncomingUser(Binder.getCallingPid(), callingUid,
1299913018
userId, /* allowAll */ false, ALLOW_FULL_ONLY, "backupAgentCreated", null);
1300013019
if (DEBUG_BACKUP) {
1300113020
Slog.v(TAG_BACKUP, "backupAgentCreated: " + agentPackageName + " = " + agent
1300213021
+ " callingUserId = " + UserHandle.getCallingUserId() + " userId = " + userId
13003-
+ " callingUid = " + Binder.getCallingUid() + " uid = " + Process.myUid());
13022+
+ " callingUid = " + callingUid + " uid = " + Process.myUid());
1300413023
}
1300513024

1300613025
synchronized(this) {

services/core/java/com/android/server/locksettings/LockSettingsService.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2994,9 +2994,19 @@ private void onCredentialVerified(AuthenticationToken authToken, PasswordMetrics
29942994
}
29952995
activateEscrowTokens(authToken, userId);
29962996

2997-
if (isProfileWithSeparatedLock(userId)) {
2998-
setDeviceUnlockedForUser(userId);
2997+
if (isCredentialSharableWithParent(userId)) {
2998+
if (getSeparateProfileChallengeEnabledInternal(userId)) {
2999+
setDeviceUnlockedForUser(userId);
3000+
} else {
3001+
// Here only clear StrongAuthFlags for a profile that has a unified challenge.
3002+
// StrongAuth for a profile with a separate challenge is handled differently and
3003+
// is cleared after the user successfully confirms the separate challenge to enter
3004+
// the profile. StrongAuth for the full user (e.g. userId 0) is also handled
3005+
// separately by Keyguard.
3006+
mStrongAuth.reportUnlock(userId);
3007+
}
29993008
}
3009+
30003010
mStrongAuth.reportSuccessfulStrongAuthUnlock(userId);
30013011

30023012
onAuthTokenKnownForUser(userId, authToken);

services/core/java/com/android/server/notification/NotificationManagerService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4368,7 +4368,7 @@ private StatusBarNotification sanitizeSbn(String pkg, int userId,
43684368
// Remove background token before returning notification to untrusted app, this
43694369
// ensures the app isn't able to perform background operations that are
43704370
// associated with notification interactions.
4371-
notification.setAllowlistToken(null);
4371+
notification.clearAllowlistToken();
43724372
return new StatusBarNotification(
43734373
sbn.getPackageName(),
43744374
sbn.getOpPkg(),

0 commit comments

Comments
 (0)