Skip to content

Commit 34637e5

Browse files
author
Christopher Tate
committed
Make sure to check write perms after rewriting destination table
The write-permission check must occur after any destination-table rewriting, otherwise any application would be able to write to any global setting, by supplying a fraudulent "system" namespace in the uri, but with a key name that will be redirected to global. Bug 7289965 Change-Id: I122098a64e40d14e00d3cb6608c50aeb74faf7ce
1 parent dce8b94 commit 34637e5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,6 @@ private Uri insertForUser(Uri url, ContentValues initialValues, int desiredUserH
849849
if (TABLE_FAVORITES.equals(args.table)) {
850850
return null;
851851
}
852-
checkWritePermissions(args);
853852

854853
// Special case LOCATION_PROVIDERS_ALLOWED.
855854
// Support enabling/disabling a single provider (using "+" or "-" prefix)
@@ -869,6 +868,9 @@ private Uri insertForUser(Uri url, ContentValues initialValues, int desiredUserH
869868
}
870869
}
871870

871+
// Check write permissions only after determining which table the insert will touch
872+
checkWritePermissions(args);
873+
872874
// The global table is stored under the owner, always
873875
if (TABLE_GLOBAL.equals(args.table)) {
874876
desiredUserHandle = UserHandle.USER_OWNER;

0 commit comments

Comments
 (0)