[tbb-commits] [tor-browser/tor-browser-60.4.0esr-8.5-1] Bug 1500906 - Suppress FileUriExposedExceptions when launching helper apps. r=jchen, a=pascalc
gk at torproject.org
gk at torproject.org
Thu Jan 24 20:03:43 UTC 2019
commit 394ffba812d69d4b5767376f0f3ff1e303ba26d1
Author: Jan Henning <jh+bitbucket at buttercookie.de>
Date: Wed Oct 24 21:02:17 2018 +0200
Bug 1500906 - Suppress FileUriExposedExceptions when launching helper apps. r=jchen, a=pascalc
Sharing tabs with file:// URIs is not possible, but users can still send them to
other apps via the helper app system in the URL bar/context menu. "Intent:Open"
and "Intent:OpenForResult" are both sent from Gecko by HelperApps.jsm.
The same reasoning as in bug 1450449 applies as to why for publicly accessible
files content:// URIs are more trouble than they're worth.
Differential Revision: https://phabricator.services.mozilla.com/D9697
---
.../base/java/org/mozilla/gecko/IntentHelper.java | 23 ++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/mobile/android/base/java/org/mozilla/gecko/IntentHelper.java b/mobile/android/base/java/org/mozilla/gecko/IntentHelper.java
index f2810a92af51..5b7948f79e04 100644
--- a/mobile/android/base/java/org/mozilla/gecko/IntentHelper.java
+++ b/mobile/android/base/java/org/mozilla/gecko/IntentHelper.java
@@ -26,6 +26,7 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Environment;
+import android.os.StrictMode;
import android.provider.Browser;
import android.provider.MediaStore;
import android.support.annotation.Nullable;
@@ -471,12 +472,18 @@ public final class IntentHelper implements BundleEventListener {
}
private void open(final GeckoBundle message) {
- openUriExternal(message.getString("url", ""),
- message.getString("mime", ""),
- message.getString("packageName", ""),
- message.getString("className", ""),
- message.getString("action", ""),
- message.getString("title", ""), false);
+ final StrictMode.VmPolicy prevPolicy = StrictMode.getVmPolicy();
+ StrictMode.setVmPolicy(StrictMode.VmPolicy.LAX);
+ try {
+ openUriExternal(message.getString("url", ""),
+ message.getString("mime", ""),
+ message.getString("packageName", ""),
+ message.getString("className", ""),
+ message.getString("action", ""),
+ message.getString("title", ""), false);
+ } finally {
+ StrictMode.setVmPolicy(prevPolicy);
+ }
}
private void openForResult(final GeckoBundle message, final EventCallback callback) {
@@ -495,10 +502,14 @@ public final class IntentHelper implements BundleEventListener {
return;
}
final ResultHandler handler = new ResultHandler(callback);
+ final StrictMode.VmPolicy prevPolicy = StrictMode.getVmPolicy();
+ StrictMode.setVmPolicy(StrictMode.VmPolicy.LAX);
try {
ActivityHandlerHelper.startIntentForActivity(activity, intent, handler);
} catch (SecurityException e) {
Log.w(LOGTAG, "Forbidden to launch activity.", e);
+ } finally {
+ StrictMode.setVmPolicy(prevPolicy);
}
}
More information about the tbb-commits
mailing list