[SettingsProvider] enforce @Readable for getAll*Settings methods
BUG: 208268457 Test: atest android.appsecurity.cts.ReadableSettingsFieldsTest Change-Id: If2512b0b7586d755104c69736c500dffde860cda Merged-In: If2512b0b7586d755104c69736c500dffde860cda
This commit is contained in:
@@ -1337,6 +1337,13 @@ public class SettingsProvider extends ContentProvider {
|
||||
// Anyone can get the global settings, so no security checks.
|
||||
for (int i = 0; i < nameCount; i++) {
|
||||
String name = names.get(i);
|
||||
try {
|
||||
enforceSettingReadable(name, SETTINGS_TYPE_GLOBAL,
|
||||
UserHandle.getCallingUserId());
|
||||
} catch (SecurityException e) {
|
||||
// Caller doesn't have permission to read this setting
|
||||
continue;
|
||||
}
|
||||
Setting setting = settingsState.getSettingLocked(name);
|
||||
appendSettingToCursor(result, setting);
|
||||
}
|
||||
@@ -1514,6 +1521,13 @@ public class SettingsProvider extends ContentProvider {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
enforceSettingReadable(name, SETTINGS_TYPE_SECURE, callingUserId);
|
||||
} catch (SecurityException e) {
|
||||
// Caller doesn't have permission to read this setting
|
||||
continue;
|
||||
}
|
||||
|
||||
// As of Android O, the SSAID is read from an app-specific entry in table
|
||||
// SETTINGS_FILE_SSAID, unless accessed by a system process.
|
||||
final Setting setting;
|
||||
@@ -1776,7 +1790,12 @@ public class SettingsProvider extends ContentProvider {
|
||||
|
||||
for (int i = 0; i < nameCount; i++) {
|
||||
String name = names.get(i);
|
||||
|
||||
try {
|
||||
enforceSettingReadable(name, SETTINGS_TYPE_SYSTEM, callingUserId);
|
||||
} catch (SecurityException e) {
|
||||
// Caller doesn't have permission to read this setting
|
||||
continue;
|
||||
}
|
||||
// Determine the owning user as some profile settings are cloned from the parent.
|
||||
final int owningUserId = resolveOwningUserIdForSystemSettingLocked(callingUserId,
|
||||
name);
|
||||
|
||||
Reference in New Issue
Block a user