Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1358)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java

Issue 2448363003: Add scheme whitelist for content intents (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java
index 0f528187c68a4237afc2df7f91c0e021d28fac0c..c18a23c8ad3daa2c9c4c627b9bda83568856b192 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java
@@ -26,12 +26,16 @@ import org.chromium.base.Log;
*/
public class ContentViewClient {
// Tag used for logging.
- private static final String TAG = "cr.ContentViewClient";
+ private static final String TAG = "cr_ContentViewClient";
Theresa 2016/10/26 17:08:09 Changed to pass a presubmit warning: Dot in log ta
// Default value to signal that the ContentView's size should not be overridden.
private static final int UNSPECIFIED_MEASURE_SPEC =
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+ private static final String GEO_SCHEME = "geo";
+ private static final String TEL_SCHEME = "tel";
+ private static final String MAILTO_SCHEME = "mailto";
+
public void onUpdateTitle(String title) {
}
@@ -144,6 +148,14 @@ public class ContentViewClient {
// Perform generic parsing of the URI to turn it into an Intent.
try {
intent = Intent.parseUri(intentUrl, Intent.URI_INTENT_SCHEME);
+
+ String scheme = intent.getScheme();
+ if (!scheme.equals(GEO_SCHEME) && !scheme.equals(TEL_SCHEME)
+ && !scheme.equals(MAILTO_SCHEME)) {
+ Log.w(TAG, "Invalid scheme for URI %s", intentUrl);
+ return;
+ }
+
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
} catch (Exception ex) {
Log.w(TAG, "Bad URI %s", intentUrl, ex);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698