• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

packages/apps/Settings


Commit MetaInfo

Revisãoc182674de735dba1d99e7d5eddefe72cbfdc74dc (tree)
Hora2021-07-01 20:01:16
AutorTsung-Mao Fang <tmfang@goog...>
CommiterAndroid Build Coastguard Worker

Mensagem de Log

Prevent HTML Injection on the Device Admin request screen

The root issue is that CharSequence is an interface.
String implements that interface, however, Spanned class
too which is a rich text format that can store HTML code.

The solution is enforce to use String type which won't include
any HTML function.

Test: Rebuilt apk and see the string without HTML style.
Bug: 179042963
Change-Id: I53b460b12da918e022d2f2934f114d205dbaadb0
Merged-In: I53b460b12da918e022d2f2934f114d205dbaadb0
(cherry picked from commit 0bf3c98b2f325f70d5492a7c7ade16951a802600)
(cherry picked from commit 52f9039d5cc775a02dab90492cca98850a82872a)

Mudança Sumário

Diff

--- a/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminAdd.java
+++ b/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminAdd.java
@@ -102,7 +102,7 @@ public class DeviceAdminAdd extends Activity {
102102 DevicePolicyManager mDPM;
103103 AppOpsManager mAppOps;
104104 DeviceAdminInfo mDeviceAdmin;
105- CharSequence mAddMsgText;
105+ String mAddMsgText;
106106 String mProfileOwnerName;
107107
108108 ImageView mAdminIcon;
@@ -274,7 +274,11 @@ public class DeviceAdminAdd extends Activity {
274274 }
275275 }
276276
277- mAddMsgText = getIntent().getCharSequenceExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION);
277+ final CharSequence addMsgCharSequence = getIntent().getCharSequenceExtra(
278+ DevicePolicyManager.EXTRA_ADD_EXPLANATION);
279+ if (addMsgCharSequence != null) {
280+ mAddMsgText = addMsgCharSequence.toString();
281+ }
278282
279283 if (mAddingProfileOwner) {
280284 // If we're trying to add a profile owner and user setup hasn't completed yet, no
@@ -628,7 +632,7 @@ public class DeviceAdminAdd extends Activity {
628632 } catch (Resources.NotFoundException e) {
629633 mAdminDescription.setVisibility(View.GONE);
630634 }
631- if (mAddMsgText != null) {
635+ if (!TextUtils.isEmpty(mAddMsgText)) {
632636 mAddMsg.setText(mAddMsgText);
633637 mAddMsg.setVisibility(View.VISIBLE);
634638 } else {