Bug 1356893 - Reject opening intents with file data schemes. r=sebastian, r=nalexander, a=jcristau
authorEugen Sawin <esawin@mozilla.com>
Mon, 22 May 2017 09:50:40 -0400
changeset 396424 9664d83f5c056a32a3cc29de9d5934b82809dbfd
parent 396423 39a7c0a521915d242aecbf8216f2941da61536fc
child 396425 eb10d90aea8f4579d4d5d6f4fafa343f217497bf
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian, nalexander, jcristau
bugs1356893
milestone54.0
Bug 1356893 - Reject opening intents with file data schemes. r=sebastian, r=nalexander, a=jcristau
mobile/android/base/java/org/mozilla/gecko/IntentHelper.java
--- a/mobile/android/base/java/org/mozilla/gecko/IntentHelper.java
+++ b/mobile/android/base/java/org/mozilla/gecko/IntentHelper.java
@@ -275,16 +275,22 @@ public final class IntentHelper implemen
             final Intent intent;
             try {
                 intent = Intent.parseUri(targetURI, 0);
             } catch (final URISyntaxException e) {
                 Log.e(LOGTAG, "Unable to parse URI - " + e);
                 return null;
             }
 
+            final Uri data = intent.getData();
+            if (data != null && "file".equals(data.normalizeScheme().getScheme())) {
+                Log.w(LOGTAG, "Blocked intent with \"file://\" data scheme.");
+                return null;
+            }
+
             // Only open applications which can accept arbitrary data from a browser.
             intent.addCategory(Intent.CATEGORY_BROWSABLE);
 
             // Prevent site from explicitly opening our internal activities, which can leak data.
             intent.setComponent(null);
             nullIntentSelector(intent);
 
             return intent;