Merge "[SettingsProvider] enforce @Readable for getAll*Settings methods" into sc-v2-dev am: 827dd0bbda
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16407721 Change-Id: Ib1cbb98666216bfe549b74d0e420d28cf7d22d5a
This commit is contained in:
@@ -1338,6 +1338,13 @@ public class SettingsProvider extends ContentProvider {
|
|||||||
// Anyone can get the global settings, so no security checks.
|
// Anyone can get the global settings, so no security checks.
|
||||||
for (int i = 0; i < nameCount; i++) {
|
for (int i = 0; i < nameCount; i++) {
|
||||||
String name = names.get(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);
|
Setting setting = settingsState.getSettingLocked(name);
|
||||||
appendSettingToCursor(result, setting);
|
appendSettingToCursor(result, setting);
|
||||||
}
|
}
|
||||||
@@ -1515,6 +1522,13 @@ public class SettingsProvider extends ContentProvider {
|
|||||||
continue;
|
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
|
// As of Android O, the SSAID is read from an app-specific entry in table
|
||||||
// SETTINGS_FILE_SSAID, unless accessed by a system process.
|
// SETTINGS_FILE_SSAID, unless accessed by a system process.
|
||||||
final Setting setting;
|
final Setting setting;
|
||||||
@@ -1777,7 +1791,12 @@ public class SettingsProvider extends ContentProvider {
|
|||||||
|
|
||||||
for (int i = 0; i < nameCount; i++) {
|
for (int i = 0; i < nameCount; i++) {
|
||||||
String name = names.get(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.
|
// Determine the owning user as some profile settings are cloned from the parent.
|
||||||
final int owningUserId = resolveOwningUserIdForSystemSettingLocked(callingUserId,
|
final int owningUserId = resolveOwningUserIdForSystemSettingLocked(callingUserId,
|
||||||
name);
|
name);
|
||||||
|
|||||||
Reference in New Issue
Block a user