aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshubang <shubang@google.com>2019-05-22 13:39:56 -0700
committerNick Chalko <nchalko@google.com>2019-05-23 14:45:04 -0700
commit0b178ce5e9b0ae8d674ba226936de0723dd85296 (patch)
tree2a4ba2fbff05efb495b4bbd0413f11039171dcaf /src
parent3bd49a09edce4884f711d933bf23ca77422975d6 (diff)
downloadTV-0b178ce5e9b0ae8d674ba226936de0723dd85296.tar.gz
Fix Intent Redirection vulnerability
PiperOrigin-RevId: 249510530 Change-Id: Id9fd59e38210acf644bf1de81b451a7e559d6ff7
Diffstat (limited to 'src')
-rw-r--r--src/com/android/tv/SetupPassthroughActivity.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/com/android/tv/SetupPassthroughActivity.java b/src/com/android/tv/SetupPassthroughActivity.java
index 95fd93d5..806bb142 100644
--- a/src/com/android/tv/SetupPassthroughActivity.java
+++ b/src/com/android/tv/SetupPassthroughActivity.java
@@ -18,6 +18,7 @@ package com.android.tv;
import android.app.Activity;
import android.content.ActivityNotFoundException;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.media.tv.TvInputInfo;
@@ -26,6 +27,7 @@ import android.os.Handler;
import android.os.Looper;
import android.support.annotation.MainThread;
import android.util.Log;
+import com.android.tv.common.CommonConstants;
import com.android.tv.common.SoftPreconditions;
import com.android.tv.common.actions.InputSetupActionUtils;
import com.android.tv.data.ChannelDataManager;
@@ -110,6 +112,17 @@ public class SetupPassthroughActivity extends Activity {
InputSetupActionUtils.removeSetupIntent(extras);
setupIntent.putExtras(extras);
try {
+ ComponentName callingActivity = getCallingActivity();
+ if (callingActivity != null
+ && !callingActivity.getPackageName().equals(CommonConstants.BASE_PACKAGE)) {
+ Log.w(
+ TAG,
+ "Calling activity "
+ + callingActivity.getPackageName()
+ + " is not trusted. Not forwarding intent.");
+ finish();
+ return;
+ }
startActivityForResult(setupIntent, REQUEST_START_SETUP_ACTIVITY);
} catch (ActivityNotFoundException e) {
Log.e(TAG, "Can't find activity: " + setupIntent.getComponent());