mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-10-01 01:35:54 -04:00
17.1 July ASB work
Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
parent
2651f33e5c
commit
b92655dac4
@ -0,0 +1,50 @@
|
||||
From cd6630c7a6387077cec3b6113313d3852bb5c2b2 Mon Sep 17 00:00:00 2001
|
||||
From: Werner Lemberg <wl@gnu.org>
|
||||
Date: Sat, 19 Mar 2022 06:40:17 +0100
|
||||
Subject: [PATCH] DO NOT MERGE - Cherry-pick two upstream changes
|
||||
|
||||
This cherry picks following two changes:
|
||||
|
||||
0c2bdb01a2e1d24a3e592377a6d0822856e10df2
|
||||
22a0cccb4d9d002f33c1ba7a4b36812c7d4f46b5
|
||||
|
||||
Bug: 271680254
|
||||
Test: N/A
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:4ffa271ab538f57b65a65d434a2df9d3f8cd2f4a)
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:b0f8930701bf19229075cc930ad15813ff5fb07b)
|
||||
Merged-In: I42469df8e8b07221d64e3f8574c4f30110dbda7e
|
||||
Change-Id: I42469df8e8b07221d64e3f8574c4f30110dbda7e
|
||||
---
|
||||
src/base/ftobjs.c | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
|
||||
index e301f8f11..70ba6e749 100644
|
||||
--- a/src/base/ftobjs.c
|
||||
+++ b/src/base/ftobjs.c
|
||||
@@ -2389,6 +2389,15 @@
|
||||
#endif
|
||||
|
||||
|
||||
+ /* only use lower 31 bits together with sign bit */
|
||||
+ if ( face_index > 0 )
|
||||
+ face_index &= 0x7FFFFFFFL;
|
||||
+ else
|
||||
+ {
|
||||
+ face_index &= 0x7FFFFFFFL;
|
||||
+ face_index = -face_index;
|
||||
+ }
|
||||
+
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
FT_TRACE3(( "FT_Open_Face: " ));
|
||||
if ( face_index < 0 )
|
||||
@@ -3244,6 +3253,9 @@
|
||||
if ( !face )
|
||||
return FT_THROW( Invalid_Face_Handle );
|
||||
|
||||
+ if ( !face->size )
|
||||
+ return FT_THROW( Invalid_Size_Handle );
|
||||
+
|
||||
if ( !req || req->width < 0 || req->height < 0 ||
|
||||
req->type >= FT_SIZE_REQUEST_TYPE_MAX )
|
||||
return FT_THROW( Invalid_Argument );
|
@ -0,0 +1,243 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: "Nate(Qiang) Jiang" <qiangjiang@google.com>
|
||||
Date: Wed, 26 Oct 2022 21:52:34 +0000
|
||||
Subject: [PATCH] Passpoint Add more check to limit the config size
|
||||
|
||||
Bug: 245299920
|
||||
Test: atest con.android.server.wifi
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:e1a80210f3f0391c989a2a86fd4aef739bf2574c)
|
||||
Merged-In: I97522ce3607547c10025caa107cd1a40455a9c5d
|
||||
Change-Id: I97522ce3607547c10025caa107cd1a40455a9c5d
|
||||
---
|
||||
.../wifi/hotspot2/PasspointConfiguration.java | 59 +++++++++++++-
|
||||
.../net/wifi/hotspot2/pps/Credential.java | 10 ++-
|
||||
.../android/net/wifi/hotspot2/pps/HomeSp.java | 79 ++++++++++++++++++-
|
||||
.../hotspot2/PasspointConfigurationTest.java | 2 +-
|
||||
4 files changed, 146 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java b/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
|
||||
index 9095b5d927a2..eff56acf4dfb 100644
|
||||
--- a/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
|
||||
+++ b/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
|
||||
@@ -52,8 +52,42 @@ public final class PasspointConfiguration implements Parcelable {
|
||||
|
||||
/**
|
||||
* Maximum bytes for URL string.
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final int MAX_URL_BYTES = 2048;
|
||||
+
|
||||
+ /**
|
||||
+ * Maximum size for match entry, just to limit the size of the Passpoint config.
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final int MAX_NUMBER_OF_ENTRIES = 16;
|
||||
+
|
||||
+ /**
|
||||
+ * Maximum size for OI entry.
|
||||
+ * The spec allows a string of up to 255 characters, with comma delimited numbers like
|
||||
+ * 001122,334455. So with minimum OI size of 7, the maximum amount of OIs is 36.
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final int MAX_NUMBER_OF_OI = 36;
|
||||
+
|
||||
+
|
||||
+ /**
|
||||
+ * Maximum bytes for a string entry like FQDN and friendly name.
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final int MAX_STRING_LENGTH = 255;
|
||||
+
|
||||
+ /**
|
||||
+ * HESSID is 48 bit.
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final long MAX_HESSID_VALUE = ((long) 1 << 48) - 1;
|
||||
+
|
||||
+ /**
|
||||
+ * Organization Identifiers is 3 or 5 Octets. 24 or 36 bit.
|
||||
+ * @hide
|
||||
*/
|
||||
- private static final int MAX_URL_BYTES = 1023;
|
||||
+ public static final long MAX_OI_VALUE = ((long) 1 << 40) - 1;
|
||||
|
||||
/**
|
||||
* Integer value used for indicating null value in the Parcel.
|
||||
@@ -572,7 +606,30 @@ public final class PasspointConfiguration implements Parcelable {
|
||||
return false;
|
||||
}
|
||||
|
||||
+ if (mAaaServerTrustedNames != null) {
|
||||
+ if (mAaaServerTrustedNames.length > MAX_NUMBER_OF_ENTRIES) {
|
||||
+ Log.d(TAG, "Too many AaaServerTrustedNames");
|
||||
+ return false;
|
||||
+ }
|
||||
+ for (String fqdn : mAaaServerTrustedNames) {
|
||||
+ if (fqdn.getBytes(StandardCharsets.UTF_8).length > MAX_STRING_LENGTH) {
|
||||
+ Log.d(TAG, "AaaServerTrustedNames is too long");
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (mSubscriptionType != null) {
|
||||
+ if (mSubscriptionType.getBytes(StandardCharsets.UTF_8).length > MAX_STRING_LENGTH) {
|
||||
+ Log.d(TAG, "SubscriptionType is too long");
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (mTrustRootCertList != null) {
|
||||
+ if (mTrustRootCertList.size() > MAX_NUMBER_OF_ENTRIES) {
|
||||
+ Log.d(TAG, "Too many TrustRootCert");
|
||||
+ return false;
|
||||
+ }
|
||||
for (Map.Entry<String, byte[]> entry : mTrustRootCertList.entrySet()) {
|
||||
String url = entry.getKey();
|
||||
byte[] certFingerprint = entry.getValue();
|
||||
diff --git a/wifi/java/android/net/wifi/hotspot2/pps/Credential.java b/wifi/java/android/net/wifi/hotspot2/pps/Credential.java
|
||||
index 9409c03c614d..6d12ccef29ae 100644
|
||||
--- a/wifi/java/android/net/wifi/hotspot2/pps/Credential.java
|
||||
+++ b/wifi/java/android/net/wifi/hotspot2/pps/Credential.java
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package android.net.wifi.hotspot2.pps;
|
||||
|
||||
+import static android.net.wifi.hotspot2.PasspointConfiguration.MAX_STRING_LENGTH;
|
||||
+
|
||||
import android.net.wifi.EAPConstants;
|
||||
import android.net.wifi.ParcelUtil;
|
||||
import android.os.Parcel;
|
||||
@@ -413,7 +415,13 @@ public final class Credential implements Parcelable {
|
||||
+ mPassword.getBytes(StandardCharsets.UTF_8).length);
|
||||
return false;
|
||||
}
|
||||
-
|
||||
+ if (mSoftTokenApp != null) {
|
||||
+ if (mSoftTokenApp.getBytes(StandardCharsets.UTF_8).length > MAX_STRING_LENGTH) {
|
||||
+ Log.d(TAG, "app name exceeding maximum length: "
|
||||
+ + mSoftTokenApp.getBytes(StandardCharsets.UTF_8).length);
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
// Only supports EAP-TTLS for user credential.
|
||||
if (mEapType != EAPConstants.EAP_TTLS) {
|
||||
Log.d(TAG, "Invalid EAP Type for user credential: " + mEapType);
|
||||
diff --git a/wifi/java/android/net/wifi/hotspot2/pps/HomeSp.java b/wifi/java/android/net/wifi/hotspot2/pps/HomeSp.java
|
||||
index 49a76c33d209..cdb9ec5cec3c 100644
|
||||
--- a/wifi/java/android/net/wifi/hotspot2/pps/HomeSp.java
|
||||
+++ b/wifi/java/android/net/wifi/hotspot2/pps/HomeSp.java
|
||||
@@ -16,6 +16,13 @@
|
||||
|
||||
package android.net.wifi.hotspot2.pps;
|
||||
|
||||
+import static android.net.wifi.hotspot2.PasspointConfiguration.MAX_HESSID_VALUE;
|
||||
+import static android.net.wifi.hotspot2.PasspointConfiguration.MAX_NUMBER_OF_ENTRIES;
|
||||
+import static android.net.wifi.hotspot2.PasspointConfiguration.MAX_NUMBER_OF_OI;
|
||||
+import static android.net.wifi.hotspot2.PasspointConfiguration.MAX_OI_VALUE;
|
||||
+import static android.net.wifi.hotspot2.PasspointConfiguration.MAX_STRING_LENGTH;
|
||||
+import static android.net.wifi.hotspot2.PasspointConfiguration.MAX_URL_BYTES;
|
||||
+
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
import android.text.TextUtils;
|
||||
@@ -328,16 +335,86 @@ public final class HomeSp implements Parcelable {
|
||||
Log.d(TAG, "Missing FQDN");
|
||||
return false;
|
||||
}
|
||||
+ if (mFqdn.getBytes(StandardCharsets.UTF_8).length > MAX_STRING_LENGTH) {
|
||||
+ Log.d(TAG, "FQDN is too long");
|
||||
+ return false;
|
||||
+ }
|
||||
if (TextUtils.isEmpty(mFriendlyName)) {
|
||||
Log.d(TAG, "Missing friendly name");
|
||||
return false;
|
||||
}
|
||||
+ if (mFriendlyName.getBytes(StandardCharsets.UTF_8).length > MAX_STRING_LENGTH) {
|
||||
+ Log.d(TAG, "Friendly name is too long");
|
||||
+ return false;
|
||||
+ }
|
||||
// Verify SSIDs specified in the NetworkID
|
||||
if (mHomeNetworkIds != null) {
|
||||
+ if (mHomeNetworkIds.size() > MAX_NUMBER_OF_ENTRIES) {
|
||||
+ Log.d(TAG, "too many SSID in HomeNetworkIDs");
|
||||
+ return false;
|
||||
+ }
|
||||
for (Map.Entry<String, Long> entry : mHomeNetworkIds.entrySet()) {
|
||||
if (entry.getKey() == null ||
|
||||
entry.getKey().getBytes(StandardCharsets.UTF_8).length > MAX_SSID_BYTES) {
|
||||
- Log.d(TAG, "Invalid SSID in HomeNetworkIDs");
|
||||
+ Log.d(TAG, "SSID is too long in HomeNetworkIDs");
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (entry.getValue() != null
|
||||
+ && (entry.getValue() > MAX_HESSID_VALUE || entry.getValue() < 0)) {
|
||||
+ Log.d(TAG, "HESSID is out of range");
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (mIconUrl != null && mIconUrl.getBytes(StandardCharsets.UTF_8).length > MAX_URL_BYTES) {
|
||||
+ Log.d(TAG, "Icon URL is too long");
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (mMatchAllOis != null) {
|
||||
+ if (mMatchAllOis.length > MAX_NUMBER_OF_OI) {
|
||||
+ Log.d(TAG, "too many match all Organization Identifiers in the profile");
|
||||
+ return false;
|
||||
+ }
|
||||
+ for (long oi : mMatchAllOis) {
|
||||
+ if (oi > MAX_OI_VALUE || oi < 0) {
|
||||
+ Log.d(TAG, "Organization Identifiers is out of range");
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (mMatchAnyOis != null) {
|
||||
+ if (mMatchAnyOis.length > MAX_NUMBER_OF_OI) {
|
||||
+ Log.d(TAG, "too many match any Organization Identifiers in the profile");
|
||||
+ return false;
|
||||
+ }
|
||||
+ for (long oi : mMatchAnyOis) {
|
||||
+ if (oi > MAX_OI_VALUE || oi < 0) {
|
||||
+ Log.d(TAG, "Organization Identifiers is out of range");
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (mRoamingConsortiumOis != null) {
|
||||
+ if (mRoamingConsortiumOis.length > MAX_NUMBER_OF_OI) {
|
||||
+ Log.d(TAG, "too many Roaming Consortium Organization Identifiers in the "
|
||||
+ + "profile");
|
||||
+ return false;
|
||||
+ }
|
||||
+ for (long oi : mRoamingConsortiumOis) {
|
||||
+ if (oi > MAX_OI_VALUE || oi < 0) {
|
||||
+ Log.d(TAG, "Organization Identifiers is out of range");
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (mOtherHomePartners != null) {
|
||||
+ if (mOtherHomePartners.length > MAX_NUMBER_OF_ENTRIES) {
|
||||
+ Log.d(TAG, "too many other home partners in the profile");
|
||||
+ return false;
|
||||
+ }
|
||||
+ for (String fqdn : mOtherHomePartners) {
|
||||
+ if (fqdn.length() > MAX_STRING_LENGTH) {
|
||||
+ Log.d(TAG, "FQDN is too long in OtherHomePartners");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
diff --git a/wifi/tests/src/android/net/wifi/hotspot2/PasspointConfigurationTest.java b/wifi/tests/src/android/net/wifi/hotspot2/PasspointConfigurationTest.java
|
||||
index fc03e7eb6176..6b4f7b0cc51e 100644
|
||||
--- a/wifi/tests/src/android/net/wifi/hotspot2/PasspointConfigurationTest.java
|
||||
+++ b/wifi/tests/src/android/net/wifi/hotspot2/PasspointConfigurationTest.java
|
||||
@@ -43,7 +43,7 @@ import java.util.Map;
|
||||
*/
|
||||
@SmallTest
|
||||
public class PasspointConfigurationTest {
|
||||
- private static final int MAX_URL_BYTES = 1023;
|
||||
+ private static final int MAX_URL_BYTES = 2048;
|
||||
private static final int CERTIFICATE_FINGERPRINT_BYTES = 32;
|
||||
|
||||
/**
|
@ -0,0 +1,145 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Lucas Lin <lucaslin@google.com>
|
||||
Date: Fri, 3 Mar 2023 08:13:50 +0000
|
||||
Subject: [PATCH] Sanitize VPN label to prevent HTML injection
|
||||
|
||||
This commit will try to sanitize the content of VpnDialog. This
|
||||
commit creates a function which will try to sanitize the VPN
|
||||
label, if the sanitized VPN label is different from the original
|
||||
one, which means the VPN label might contain HTML tag or the VPN
|
||||
label violates the words restriction(may contain some wording
|
||||
which will mislead the user). For this kind of case, show the
|
||||
package name instead of the VPN label to prevent misleading the
|
||||
user.
|
||||
|
||||
The malicious VPN app might be able to add a large number of line
|
||||
breaks with HTML in order to hide the system-displayed text from
|
||||
the user in the connection request dialog. Thus, sanitizing the
|
||||
content of the dialog is needed.
|
||||
|
||||
Bug: 204554636
|
||||
Test: N/A
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:2178216b98bf9865edee198f45192f0b883624ab)
|
||||
Merged-In: I8eb890fd2e5797d8d6ab5b12f9c628bc9616081d
|
||||
Change-Id: I8eb890fd2e5797d8d6ab5b12f9c628bc9616081d
|
||||
---
|
||||
packages/VpnDialogs/res/values/strings.xml | 28 ++++++++++
|
||||
.../com/android/vpndialogs/ConfirmDialog.java | 53 +++++++++++++++++--
|
||||
2 files changed, 76 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/packages/VpnDialogs/res/values/strings.xml b/packages/VpnDialogs/res/values/strings.xml
|
||||
index 443a9bc33b90..b4166f0bedfd 100644
|
||||
--- a/packages/VpnDialogs/res/values/strings.xml
|
||||
+++ b/packages/VpnDialogs/res/values/strings.xml
|
||||
@@ -89,4 +89,32 @@
|
||||
without any consequences. [CHAR LIMIT=20] -->
|
||||
<string name="dismiss">Dismiss</string>
|
||||
|
||||
+ <!-- Malicious VPN apps may provide very long labels or cunning HTML to trick the system dialogs
|
||||
+ into displaying what they want. The system will attempt to sanitize the label, and if the
|
||||
+ label is deemed dangerous, then this string is used instead. The first argument is the
|
||||
+ first 30 characters of the label, and the second argument is the package name of the app.
|
||||
+ Example : Normally a VPN app may be called "My VPN app" in which case the dialog will read
|
||||
+ "My VPN app wants to set up a VPN connection...". If the label is very long, then, this
|
||||
+ will be used to show "VerylongVPNlabel… (com.my.vpn.app) wants to set up a VPN
|
||||
+ connection...". For this case, the code will refer to sanitized_vpn_label_with_ellipsis.
|
||||
+ -->
|
||||
+ <string name="sanitized_vpn_label_with_ellipsis">
|
||||
+ <xliff:g id="sanitized_vpn_label_with_ellipsis" example="My VPN app">%1$s</xliff:g>… (
|
||||
+ <xliff:g id="sanitized_vpn_label_with_ellipsis" example="com.my.vpn.app">%2$s</xliff:g>)
|
||||
+ </string>
|
||||
+
|
||||
+ <!-- Malicious VPN apps may provide very long labels or cunning HTML to trick the system dialogs
|
||||
+ into displaying what they want. The system will attempt to sanitize the label, and if the
|
||||
+ label is deemed dangerous, then this string is used instead. The first argument is the
|
||||
+ label, and the second argument is the package name of the app.
|
||||
+ Example : Normally a VPN app may be called "My VPN app" in which case the dialog will read
|
||||
+ "My VPN app wants to set up a VPN connection...". If the VPN label contains HTML tag but
|
||||
+ the length is not very long, the dialog will show "VpnLabelWith<br>HtmlTag
|
||||
+ (com.my.vpn.app) wants to set up a VPN connection...". For this case, the code will refer
|
||||
+ to sanitized_vpn_label.
|
||||
+ -->
|
||||
+ <string name="sanitized_vpn_label">
|
||||
+ <xliff:g id="sanitized_vpn_label" example="My VPN app">%1$s</xliff:g> (
|
||||
+ <xliff:g id="sanitized_vpn_label" example="com.my.vpn.app">%2$s</xliff:g>)
|
||||
+ </string>
|
||||
</resources>
|
||||
diff --git a/packages/VpnDialogs/src/com/android/vpndialogs/ConfirmDialog.java b/packages/VpnDialogs/src/com/android/vpndialogs/ConfirmDialog.java
|
||||
index 48adb9ba3f63..f74cc2f93916 100644
|
||||
--- a/packages/VpnDialogs/src/com/android/vpndialogs/ConfirmDialog.java
|
||||
+++ b/packages/VpnDialogs/src/com/android/vpndialogs/ConfirmDialog.java
|
||||
@@ -43,10 +43,52 @@ public class ConfirmDialog extends AlertActivity
|
||||
implements DialogInterface.OnClickListener, ImageGetter {
|
||||
private static final String TAG = "VpnConfirm";
|
||||
|
||||
+ // Usually the label represents the app name, 150 code points might be enough to display the app
|
||||
+ // name, and 150 code points won't cover the warning message from VpnDialog.
|
||||
+ static final int MAX_VPN_LABEL_LENGTH = 150;
|
||||
+
|
||||
private String mPackage;
|
||||
|
||||
private IConnectivityManager mService;
|
||||
|
||||
+ private View mView;
|
||||
+
|
||||
+ /**
|
||||
+ * This function will use the string resource to combine the VPN label and the package name.
|
||||
+ *
|
||||
+ * If the VPN label violates the length restriction, the first 30 code points of VPN label and
|
||||
+ * the package name will be returned. Or return the VPN label and the package name directly if
|
||||
+ * the VPN label doesn't violate the length restriction.
|
||||
+ *
|
||||
+ * The result will be something like,
|
||||
+ * - ThisIsAVeryLongVpnAppNameWhich... (com.vpn.app)
|
||||
+ * if the VPN label violates the length restriction.
|
||||
+ * or
|
||||
+ * - VpnLabelWith<br>HtmlTag (com.vpn.app)
|
||||
+ * if the VPN label doesn't violate the length restriction.
|
||||
+ *
|
||||
+ */
|
||||
+ private String getSimplifiedLabel(String vpnLabel, String packageName) {
|
||||
+ if (vpnLabel.codePointCount(0, vpnLabel.length()) > 30) {
|
||||
+ return getString(R.string.sanitized_vpn_label_with_ellipsis,
|
||||
+ vpnLabel.substring(0, vpnLabel.offsetByCodePoints(0, 30)),
|
||||
+ packageName);
|
||||
+ }
|
||||
+
|
||||
+ return getString(R.string.sanitized_vpn_label, vpnLabel, packageName);
|
||||
+ }
|
||||
+
|
||||
+ protected String getSanitizedVpnLabel(String vpnLabel, String packageName) {
|
||||
+ final String sanitizedVpnLabel = Html.escapeHtml(vpnLabel);
|
||||
+ final boolean exceedMaxVpnLabelLength = sanitizedVpnLabel.codePointCount(0,
|
||||
+ sanitizedVpnLabel.length()) > MAX_VPN_LABEL_LENGTH;
|
||||
+ if (exceedMaxVpnLabelLength || !vpnLabel.equals(sanitizedVpnLabel)) {
|
||||
+ return getSimplifiedLabel(sanitizedVpnLabel, packageName);
|
||||
+ }
|
||||
+
|
||||
+ return sanitizedVpnLabel;
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -69,15 +111,16 @@ public class ConfirmDialog extends AlertActivity
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
- View view = View.inflate(this, R.layout.confirm, null);
|
||||
- ((TextView) view.findViewById(R.id.warning)).setText(
|
||||
- Html.fromHtml(getString(R.string.warning, getVpnLabel()),
|
||||
- this, null /* tagHandler */));
|
||||
+ mView = View.inflate(this, R.layout.confirm, null);
|
||||
+ ((TextView) mView.findViewById(R.id.warning)).setText(
|
||||
+ Html.fromHtml(getString(R.string.warning, getSanitizedVpnLabel(
|
||||
+ getVpnLabel().toString(), mPackage)),
|
||||
+ this /* imageGetter */, null /* tagHandler */));
|
||||
mAlertParams.mTitle = getText(R.string.prompt);
|
||||
mAlertParams.mPositiveButtonText = getText(android.R.string.ok);
|
||||
mAlertParams.mPositiveButtonListener = this;
|
||||
mAlertParams.mNegativeButtonText = getText(android.R.string.cancel);
|
||||
- mAlertParams.mView = view;
|
||||
+ mAlertParams.mView = mView;
|
||||
setupAlert();
|
||||
|
||||
getWindow().setCloseOnTouchOutside(false);
|
84
Patches/LineageOS-17.1/android_frameworks_base/360954.patch
Normal file
84
Patches/LineageOS-17.1/android_frameworks_base/360954.patch
Normal file
@ -0,0 +1,84 @@
|
||||
From 40c4c5abce61b881309acc19be8f483f419ca9a7 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Groover <mpgroover@google.com>
|
||||
Date: Fri, 31 Mar 2023 21:31:22 +0000
|
||||
Subject: [PATCH] Limit the number of supported v1 and v2 signers
|
||||
|
||||
The v1 and v2 APK Signature Schemes support multiple signers; this
|
||||
was intended to allow multiple entities to sign an APK. Previously,
|
||||
the platform had no limits placed on the number of signers supported
|
||||
in an APK, but this commit sets a hard limit of 10 supported signers
|
||||
for these signature schemes to ensure a large number of signers
|
||||
does not place undue burden on the platform.
|
||||
|
||||
Bug: 266580022
|
||||
Test: Manually verified the platform only allowed an APK with the
|
||||
maximum number of supported signers.
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:6f6ee8a55f37c2b8c0df041b2bd53ec928764597)
|
||||
Merged-In: I6aa86b615b203cdc69d58a593ccf8f18474ca091
|
||||
Change-Id: I6aa86b615b203cdc69d58a593ccf8f18474ca091
|
||||
---
|
||||
.../util/apk/ApkSignatureSchemeV2Verifier.java | 10 ++++++++++
|
||||
core/java/android/util/jar/StrictJarVerifier.java | 11 +++++++++++
|
||||
2 files changed, 21 insertions(+)
|
||||
|
||||
diff --git a/core/java/android/util/apk/ApkSignatureSchemeV2Verifier.java b/core/java/android/util/apk/ApkSignatureSchemeV2Verifier.java
|
||||
index 346fe293d7aee..f0c20bec7d7b6 100644
|
||||
--- a/core/java/android/util/apk/ApkSignatureSchemeV2Verifier.java
|
||||
+++ b/core/java/android/util/apk/ApkSignatureSchemeV2Verifier.java
|
||||
@@ -75,6 +75,11 @@ public class ApkSignatureSchemeV2Verifier {
|
||||
|
||||
private static final int APK_SIGNATURE_SCHEME_V2_BLOCK_ID = 0x7109871a;
|
||||
|
||||
+ /**
|
||||
+ * The maximum number of signers supported by the v2 APK signature scheme.
|
||||
+ */
|
||||
+ private static final int MAX_V2_SIGNERS = 10;
|
||||
+
|
||||
/**
|
||||
* Returns {@code true} if the provided APK contains an APK Signature Scheme V2 signature.
|
||||
*
|
||||
@@ -183,6 +188,11 @@ private static VerifiedSigner verify(
|
||||
}
|
||||
while (signers.hasRemaining()) {
|
||||
signerCount++;
|
||||
+ if (signerCount > MAX_V2_SIGNERS) {
|
||||
+ throw new SecurityException(
|
||||
+ "APK Signature Scheme v2 only supports a maximum of " + MAX_V2_SIGNERS
|
||||
+ + " signers");
|
||||
+ }
|
||||
try {
|
||||
ByteBuffer signer = getLengthPrefixedSlice(signers);
|
||||
X509Certificate[] certs = verifySigner(signer, contentDigests, certFactory);
|
||||
diff --git a/core/java/android/util/jar/StrictJarVerifier.java b/core/java/android/util/jar/StrictJarVerifier.java
|
||||
index 45254908c5c96..a6aca330d323e 100644
|
||||
--- a/core/java/android/util/jar/StrictJarVerifier.java
|
||||
+++ b/core/java/android/util/jar/StrictJarVerifier.java
|
||||
@@ -78,6 +78,11 @@ class StrictJarVerifier {
|
||||
"SHA1",
|
||||
};
|
||||
|
||||
+ /**
|
||||
+ * The maximum number of signers supported by the JAR signature scheme.
|
||||
+ */
|
||||
+ private static final int MAX_JAR_SIGNERS = 10;
|
||||
+
|
||||
private final String jarName;
|
||||
private final StrictJarManifest manifest;
|
||||
private final HashMap<String, byte[]> metaEntries;
|
||||
@@ -293,10 +298,16 @@ synchronized boolean readCertificates() {
|
||||
return false;
|
||||
}
|
||||
|
||||
+ int signerCount = 0;
|
||||
Iterator<String> it = metaEntries.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
String key = it.next();
|
||||
if (key.endsWith(".DSA") || key.endsWith(".RSA") || key.endsWith(".EC")) {
|
||||
+ if (++signerCount > MAX_JAR_SIGNERS) {
|
||||
+ throw new SecurityException(
|
||||
+ "APK Signature Scheme v1 only supports a maximum of " + MAX_JAR_SIGNERS
|
||||
+ + " signers");
|
||||
+ }
|
||||
verifyCertificate(key);
|
||||
it.remove();
|
||||
}
|
1034
Patches/LineageOS-17.1/android_frameworks_base/360955.patch
Normal file
1034
Patches/LineageOS-17.1/android_frameworks_base/360955.patch
Normal file
File diff suppressed because it is too large
Load Diff
85
Patches/LineageOS-17.1/android_frameworks_base/360956.patch
Normal file
85
Patches/LineageOS-17.1/android_frameworks_base/360956.patch
Normal file
@ -0,0 +1,85 @@
|
||||
From fcbc4bc0d51ae2f9180ddea578d0a0defb742662 Mon Sep 17 00:00:00 2001
|
||||
From: "Nate(Qiang) Jiang" <qiangjiang@google.com>
|
||||
Date: Thu, 13 Apr 2023 21:20:37 +0000
|
||||
Subject: [PATCH] DO NOT MERGE: Add size check on PPS#policy
|
||||
|
||||
Bug: 275340417
|
||||
Test: atest android.net.wifi
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:d1afd2c47d086e0365bf6814a9f47555c294769f)
|
||||
Merged-In: I6e6128b7ed5327da8dbc9186a82bef0f2e4197bb
|
||||
Change-Id: I6e6128b7ed5327da8dbc9186a82bef0f2e4197bb
|
||||
---
|
||||
.../android/net/wifi/hotspot2/pps/Policy.java | 28 ++++++++++++++++---
|
||||
1 file changed, 24 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/wifi/java/android/net/wifi/hotspot2/pps/Policy.java b/wifi/java/android/net/wifi/hotspot2/pps/Policy.java
|
||||
index b0a2cc397c53b..4bdacebda0606 100644
|
||||
--- a/wifi/java/android/net/wifi/hotspot2/pps/Policy.java
|
||||
+++ b/wifi/java/android/net/wifi/hotspot2/pps/Policy.java
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
package android.net.wifi.hotspot2.pps;
|
||||
|
||||
+import static android.net.wifi.hotspot2.PasspointConfiguration.MAX_NUMBER_OF_ENTRIES;
|
||||
+import static android.net.wifi.hotspot2.PasspointConfiguration.MAX_STRING_LENGTH;
|
||||
+
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
@@ -269,11 +272,19 @@ public String toString() {
|
||||
*/
|
||||
public boolean validate() {
|
||||
if (TextUtils.isEmpty(mFqdn)) {
|
||||
- Log.d(TAG, "Missing FQDN");
|
||||
+ Log.e(TAG, "Missing FQDN");
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (mFqdn.getBytes(StandardCharsets.UTF_8).length > MAX_STRING_LENGTH) {
|
||||
+ Log.e(TAG, "FQDN is too long");
|
||||
return false;
|
||||
}
|
||||
if (TextUtils.isEmpty(mCountries)) {
|
||||
- Log.d(TAG, "Missing countries");
|
||||
+ Log.e(TAG, "Missing countries");
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (mCountries.getBytes(StandardCharsets.UTF_8).length > MAX_STRING_LENGTH) {
|
||||
+ Log.e(TAG, "country is too long");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -449,7 +460,7 @@ public boolean validate() {
|
||||
}
|
||||
for (String ssid : mExcludedSsidList) {
|
||||
if (ssid.getBytes(StandardCharsets.UTF_8).length > MAX_SSID_BYTES) {
|
||||
- Log.d(TAG, "Invalid SSID: " + ssid);
|
||||
+ Log.e(TAG, "Invalid SSID: " + ssid);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -457,15 +468,24 @@ public boolean validate() {
|
||||
// Validate required protocol to port map.
|
||||
if (mRequiredProtoPortMap != null) {
|
||||
for (Map.Entry<Integer, String> entry : mRequiredProtoPortMap.entrySet()) {
|
||||
+ int protocol = entry.getKey();
|
||||
+ if (protocol < 0 || protocol > 255) {
|
||||
+ Log.e(TAG, "Invalid IP protocol: " + protocol);
|
||||
+ return false;
|
||||
+ }
|
||||
String portNumber = entry.getValue();
|
||||
if (portNumber.getBytes(StandardCharsets.UTF_8).length > MAX_PORT_STRING_BYTES) {
|
||||
- Log.d(TAG, "PortNumber string bytes exceeded the max: " + portNumber);
|
||||
+ Log.e(TAG, "PortNumber string bytes exceeded the max: " + portNumber);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Validate preferred roaming partner list.
|
||||
if (mPreferredRoamingPartnerList != null) {
|
||||
+ if (mPreferredRoamingPartnerList.size() > MAX_NUMBER_OF_ENTRIES) {
|
||||
+ Log.e(TAG, "Number of the Preferred Roaming Partner exceed the limit");
|
||||
+ return false;
|
||||
+ }
|
||||
for (RoamingPartner partner : mPreferredRoamingPartnerList) {
|
||||
if (!partner.validate()) {
|
||||
return false;
|
42
Patches/LineageOS-17.1/android_frameworks_base/360957.patch
Normal file
42
Patches/LineageOS-17.1/android_frameworks_base/360957.patch
Normal file
@ -0,0 +1,42 @@
|
||||
From cd13551b9bc759701bbaa50fc0b2c77f0de6e122 Mon Sep 17 00:00:00 2001
|
||||
From: "Nate(Qiang) Jiang" <qiangjiang@google.com>
|
||||
Date: Wed, 12 Apr 2023 18:32:50 +0000
|
||||
Subject: [PATCH] DO NOT MERGE: Limit the ServiceFriendlyNames
|
||||
|
||||
Bug: 274445194
|
||||
Test: atest android.net.wifi
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:6b1746ab6f0ff4020c78381833554f20344c2e2a)
|
||||
Merged-In: Id4e16007531ba1ce3e3f9fa3d3111b5af57751be
|
||||
Change-Id: Id4e16007531ba1ce3e3f9fa3d3111b5af57751be
|
||||
---
|
||||
.../wifi/hotspot2/PasspointConfiguration.java | 17 +++++++++++++++++
|
||||
1 file changed, 17 insertions(+)
|
||||
|
||||
diff --git a/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java b/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
|
||||
index 09f91d688f7ba..a6509e3e9fe10 100644
|
||||
--- a/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
|
||||
+++ b/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java
|
||||
@@ -842,6 +842,23 @@ private boolean validateForCommonR1andR2() {
|
||||
}
|
||||
}
|
||||
}
|
||||
+ if (mServiceFriendlyNames != null) {
|
||||
+ if (mServiceFriendlyNames.size() > MAX_NUMBER_OF_ENTRIES) {
|
||||
+ Log.e(TAG, "ServiceFriendlyNames exceed the max!");
|
||||
+ return false;
|
||||
+ }
|
||||
+ for (Map.Entry<String, String> names : mServiceFriendlyNames.entrySet()) {
|
||||
+ if (names.getKey() == null || names.getValue() == null) {
|
||||
+ Log.e(TAG, "Service friendly name entry should not be null");
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (names.getKey().length() > MAX_STRING_LENGTH
|
||||
+ || names.getValue().length() > MAX_STRING_LENGTH) {
|
||||
+ Log.e(TAG, "Service friendly name is to long");
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
return true;
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Winson Chung <winsonc@google.com>
|
||||
Date: Wed, 8 Feb 2023 01:04:46 +0000
|
||||
Subject: [PATCH] Only allow NEW_TASK flag when adjusting pending intents
|
||||
|
||||
Bug: 243794108
|
||||
Test: atest CtsSecurityBulletinHostTestCases:android.security.cts.CVE_2023_20918
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:c62d2e1021a030f4f0ae5fcfc8fe8e0875fa669f)
|
||||
Merged-In: I5d329beecef1902c36704e93d0bc5cb60d0e2f5b
|
||||
Change-Id: I5d329beecef1902c36704e93d0bc5cb60d0e2f5b
|
||||
---
|
||||
core/java/android/app/ActivityOptions.java | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java
|
||||
index 36ab62aedc09..c8f54fd275ee 100644
|
||||
--- a/core/java/android/app/ActivityOptions.java
|
||||
+++ b/core/java/android/app/ActivityOptions.java
|
||||
@@ -20,6 +20,8 @@ import static android.Manifest.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIO
|
||||
import static android.app.ActivityTaskManager.SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
|
||||
+import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
||||
+import static android.content.Intent.FLAG_RECEIVER_FOREGROUND;
|
||||
import static android.view.Display.INVALID_DISPLAY;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
@@ -1262,7 +1264,9 @@ public class ActivityOptions extends ComponentOptions {
|
||||
* @hide
|
||||
*/
|
||||
public int getPendingIntentLaunchFlags() {
|
||||
- return mPendingIntentLaunchFlags;
|
||||
+ // b/243794108: Ignore all flags except the new task flag, to be reconsidered in b/254490217
|
||||
+ return mPendingIntentLaunchFlags &
|
||||
+ (FLAG_ACTIVITY_NEW_TASK | FLAG_RECEIVER_FOREGROUND);
|
||||
}
|
||||
|
||||
/**
|
39
Patches/LineageOS-17.1/android_frameworks_base/360959.patch
Normal file
39
Patches/LineageOS-17.1/android_frameworks_base/360959.patch
Normal file
@ -0,0 +1,39 @@
|
||||
From 9a334720003494e411ab0f0cfd66b3cc4cc104fb Mon Sep 17 00:00:00 2001
|
||||
From: Aaron Liu <aaronjli@google.com>
|
||||
Date: Tue, 28 Mar 2023 13:15:04 -0700
|
||||
Subject: [PATCH] DO NOT MERGE Dismiss keyguard when simpin auth'd and...
|
||||
|
||||
security method is none. This is mostly to fix the case where we auth
|
||||
sim pin in the set up wizard and it goes straight to keyguard instead of
|
||||
the setup wizard activity.
|
||||
|
||||
This works with the prevent bypass keyguard flag because the device
|
||||
should be noe secure in this case.
|
||||
|
||||
Fixes: 222446076
|
||||
Test: turn locked sim on, which opens the sim pin screen. Auth the
|
||||
screen and observe that keyguard is not shown.
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:48fa9bef3451e4a358c941af5b230f99881c5cb6)
|
||||
Cherry-picking this CL as a security fix
|
||||
|
||||
Bug: 222446076
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:09f004722284ef6b9790ddf9338a1708b3f0833c)
|
||||
Merged-In: If4360dd6ae2e5f79b43eaf1a29687ac9cc4b6101
|
||||
Change-Id: If4360dd6ae2e5f79b43eaf1a29687ac9cc4b6101
|
||||
---
|
||||
.../src/com/android/keyguard/KeyguardSecurityContainer.java | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
|
||||
index b2020d9fe2d53..1cef61a2e18a1 100644
|
||||
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
|
||||
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
|
||||
@@ -739,7 +739,7 @@ boolean showNextSecurityScreenOrFinish(boolean authenticated, int targetUserId,
|
||||
case SimPuk:
|
||||
// Shortcut for SIM PIN/PUK to go to directly to user's security screen or home
|
||||
SecurityMode securityMode = mSecurityModel.getSecurityMode(targetUserId);
|
||||
- if (securityMode == SecurityMode.None && mLockPatternUtils.isLockScreenDisabled(
|
||||
+ if (securityMode == SecurityMode.None || mLockPatternUtils.isLockScreenDisabled(
|
||||
KeyguardUpdateMonitor.getCurrentUser())) {
|
||||
finish = true;
|
||||
eventSubtype = BOUNCER_DISMISS_SIM;
|
30
Patches/LineageOS-17.1/android_frameworks_base/360960.patch
Normal file
30
Patches/LineageOS-17.1/android_frameworks_base/360960.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From 67b68368ef609a22b83b48d355cbef2e01480a88 Mon Sep 17 00:00:00 2001
|
||||
From: Ioana Alexandru <aioana@google.com>
|
||||
Date: Fri, 28 Apr 2023 14:11:04 +0000
|
||||
Subject: [PATCH] DO NOT MERGE Increase notification channel limit.
|
||||
|
||||
This was previously reduced because it can cause an out of memory error or be abused to trigger a permanent denial of service, but it breaks some messages apps in Android 11, as they are creating too many channels. Rolling it back until the apps are fixed to reduce user impact.
|
||||
|
||||
Bug: 279447569
|
||||
Bug: 261723753
|
||||
Test: N/A, this was previously 50k
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5664378a7cac48184ec0702a41aaed0677d41136)
|
||||
Merged-In: Id8da382f812d4abb8db723c40a61366a7402da4f
|
||||
Change-Id: Id8da382f812d4abb8db723c40a61366a7402da4f
|
||||
---
|
||||
.../java/com/android/server/notification/PreferencesHelper.java | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/notification/PreferencesHelper.java b/services/core/java/com/android/server/notification/PreferencesHelper.java
|
||||
index 8f969dc83a09c..282816079a262 100644
|
||||
--- a/services/core/java/com/android/server/notification/PreferencesHelper.java
|
||||
+++ b/services/core/java/com/android/server/notification/PreferencesHelper.java
|
||||
@@ -92,7 +92,7 @@ public class PreferencesHelper implements RankingConfig {
|
||||
private static final String NON_BLOCKABLE_CHANNEL_DELIM = ":";
|
||||
|
||||
@VisibleForTesting
|
||||
- static final int NOTIFICATION_CHANNEL_COUNT_LIMIT = 5000;
|
||||
+ static final int NOTIFICATION_CHANNEL_COUNT_LIMIT = 50000;
|
||||
@VisibleForTesting
|
||||
static final int NOTIFICATION_CHANNEL_GROUP_COUNT_LIMIT = 6000;
|
||||
|
@ -0,0 +1,102 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ioana Alexandru <aioana@google.com>
|
||||
Date: Fri, 21 Apr 2023 15:39:22 +0000
|
||||
Subject: [PATCH] Verify URI permissions for EXTRA_REMOTE_INPUT_HISTORY_ITEMS.
|
||||
|
||||
Also added the person URIs in the test, since they weren't being
|
||||
checked.
|
||||
|
||||
Test: atest NotificationManagerServiceTest & tested with POC from bug
|
||||
Bug: 276729064
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:e0d8602a0200ba92283463bd54cefcf97394bfa8)
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:63f8ce3efd9a564ae83f1de38791a6d67c5a8ddb)
|
||||
Merged-In: I848545f7aee202495c515f47a32871a2cb6ae707
|
||||
Change-Id: I848545f7aee202495c515f47a32871a2cb6ae707
|
||||
---
|
||||
core/java/android/app/Notification.java | 11 +++++++
|
||||
.../NotificationManagerServiceTest.java | 32 +++++++++++++++++++
|
||||
2 files changed, 43 insertions(+)
|
||||
|
||||
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
|
||||
index 3e75c52bf893..9fe3583df601 100644
|
||||
--- a/core/java/android/app/Notification.java
|
||||
+++ b/core/java/android/app/Notification.java
|
||||
@@ -2454,6 +2454,17 @@ public class Notification implements Parcelable
|
||||
if (extras.containsKey(EXTRA_BACKGROUND_IMAGE_URI)) {
|
||||
visitor.accept(Uri.parse(extras.getString(EXTRA_BACKGROUND_IMAGE_URI)));
|
||||
}
|
||||
+
|
||||
+ final RemoteInputHistoryItem[] history = (RemoteInputHistoryItem[])
|
||||
+ extras.getParcelableArray(Notification.EXTRA_REMOTE_INPUT_HISTORY_ITEMS);
|
||||
+ if (history != null) {
|
||||
+ for (int i = 0; i < history.length; i++) {
|
||||
+ RemoteInputHistoryItem item = history[i];
|
||||
+ if (item.getUri() != null) {
|
||||
+ visitor.accept(item.getUri());
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
if (MessagingStyle.class.equals(getNotificationStyle()) && extras != null) {
|
||||
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
|
||||
index 6c1620751866..b2ce41f5b373 100755
|
||||
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
|
||||
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
|
||||
@@ -93,6 +93,7 @@ import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Person;
|
||||
import android.app.RemoteInput;
|
||||
+import android.app.RemoteInputHistoryItem;
|
||||
import android.app.admin.DevicePolicyManagerInternal;
|
||||
import android.app.usage.UsageStatsManagerInternal;
|
||||
import android.companion.ICompanionDeviceManager;
|
||||
@@ -3414,10 +3415,36 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
|
||||
public void testVisitUris() throws Exception {
|
||||
final Uri audioContents = Uri.parse("content://com.example/audio");
|
||||
final Uri backgroundImage = Uri.parse("content://com.example/background");
|
||||
+ final Icon personIcon1 = Icon.createWithContentUri("content://media/person1");
|
||||
+ final Icon personIcon2 = Icon.createWithContentUri("content://media/person2");
|
||||
+ final Icon personIcon3 = Icon.createWithContentUri("content://media/person3");
|
||||
+ final Person person1 = new Person.Builder()
|
||||
+ .setName("Messaging Person")
|
||||
+ .setIcon(personIcon1)
|
||||
+ .build();
|
||||
+ final Person person2 = new Person.Builder()
|
||||
+ .setName("People List Person 1")
|
||||
+ .setIcon(personIcon2)
|
||||
+ .build();
|
||||
+ final Person person3 = new Person.Builder()
|
||||
+ .setName("People List Person 2")
|
||||
+ .setIcon(personIcon3)
|
||||
+ .build();
|
||||
+ final Uri historyUri1 = Uri.parse("content://com.example/history1");
|
||||
+ final Uri historyUri2 = Uri.parse("content://com.example/history2");
|
||||
+ final RemoteInputHistoryItem historyItem1 = new RemoteInputHistoryItem(null, historyUri1,
|
||||
+ "a");
|
||||
+ final RemoteInputHistoryItem historyItem2 = new RemoteInputHistoryItem(null, historyUri2,
|
||||
+ "b");
|
||||
|
||||
Bundle extras = new Bundle();
|
||||
extras.putParcelable(Notification.EXTRA_AUDIO_CONTENTS_URI, audioContents);
|
||||
extras.putString(Notification.EXTRA_BACKGROUND_IMAGE_URI, backgroundImage.toString());
|
||||
+ extras.putParcelable(Notification.EXTRA_MESSAGING_PERSON, person1);
|
||||
+ extras.putParcelableArrayList(Notification.EXTRA_PEOPLE_LIST,
|
||||
+ new ArrayList<>(Arrays.asList(person2, person3)));
|
||||
+ extras.putParcelableArray(Notification.EXTRA_REMOTE_INPUT_HISTORY_ITEMS,
|
||||
+ new RemoteInputHistoryItem[]{historyItem1, historyItem2});
|
||||
|
||||
Notification n = new Notification.Builder(mContext, "a")
|
||||
.setContentTitle("notification with uris")
|
||||
@@ -3429,6 +3456,11 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
|
||||
n.visitUris(visitor);
|
||||
verify(visitor, times(1)).accept(eq(audioContents));
|
||||
verify(visitor, times(1)).accept(eq(backgroundImage));
|
||||
+ verify(visitor, times(1)).accept(eq(personIcon1.getUri()));
|
||||
+ verify(visitor, times(1)).accept(eq(personIcon2.getUri()));
|
||||
+ verify(visitor, times(1)).accept(eq(personIcon3.getUri()));
|
||||
+ verify(visitor, times(1)).accept(eq(historyUri1));
|
||||
+ verify(visitor, times(1)).accept(eq(historyUri2));
|
||||
}
|
||||
|
||||
@Test
|
@ -0,0 +1,99 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Andr=C3=A1s=20Kurucz?= <kurucz@google.com>
|
||||
Date: Fri, 21 Apr 2023 09:45:07 +0000
|
||||
Subject: [PATCH] Truncate ShortcutInfo Id
|
||||
|
||||
Creating Conversation with a ShortcutId longer than 65_535 (max unsigned short), we did not save the conversation settings into the notification_policy.xml due to a restriction in FastDataOutput.
|
||||
This put us to a state where the user changing the importance or turning off the notifications for the given conversation had no effect on notification behavior.
|
||||
|
||||
Fixes: 273729476
|
||||
Test: atest ShortcutManagerTest2
|
||||
Test: Create a test app which creates a Conversation with a long shortcutId. Go to the Conversation Settings and turn off Notifications. Post a new Notification to this Conversation and see if it is displayed.
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:f31df6234091b5b1de258a01dd4b2d8e5415ee2e)
|
||||
Merged-In: I2617de6f9e8a7dbfd8fbeff589a7d592f00d87c5
|
||||
Change-Id: I2617de6f9e8a7dbfd8fbeff589a7d592f00d87c5
|
||||
---
|
||||
.../java/android/content/pm/ShortcutInfo.java | 20 ++++++++++++++++---
|
||||
.../server/pm/ShortcutManagerTest2.java | 10 ++++++++++
|
||||
2 files changed, 27 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/core/java/android/content/pm/ShortcutInfo.java b/core/java/android/content/pm/ShortcutInfo.java
|
||||
index 58aacc2c36c7..4bd28aefc0a9 100644
|
||||
--- a/core/java/android/content/pm/ShortcutInfo.java
|
||||
+++ b/core/java/android/content/pm/ShortcutInfo.java
|
||||
@@ -236,6 +236,12 @@ public final class ShortcutInfo implements Parcelable {
|
||||
*/
|
||||
public static final int DISABLED_REASON_OTHER_RESTORE_ISSUE = 103;
|
||||
|
||||
+ /**
|
||||
+ * The maximum length of Shortcut ID. IDs will be truncated at this limit.
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final int MAX_ID_LENGTH = 1000;
|
||||
+
|
||||
/** @hide */
|
||||
@IntDef(prefix = { "DISABLED_REASON_" }, value = {
|
||||
DISABLED_REASON_NOT_DISABLED,
|
||||
@@ -408,8 +414,7 @@ public final class ShortcutInfo implements Parcelable {
|
||||
|
||||
private ShortcutInfo(Builder b) {
|
||||
mUserId = b.mContext.getUserId();
|
||||
-
|
||||
- mId = Preconditions.checkStringNotEmpty(b.mId, "Shortcut ID must be provided");
|
||||
+ mId = getSafeId(Preconditions.checkStringNotEmpty(b.mId, "Shortcut ID must be provided"));
|
||||
|
||||
// Note we can't do other null checks here because SM.updateShortcuts() takes partial
|
||||
// information.
|
||||
@@ -511,6 +516,14 @@ public final class ShortcutInfo implements Parcelable {
|
||||
return ret;
|
||||
}
|
||||
|
||||
+ @NonNull
|
||||
+ private static String getSafeId(@NonNull String id) {
|
||||
+ if (id.length() > MAX_ID_LENGTH) {
|
||||
+ return id.substring(0, MAX_ID_LENGTH);
|
||||
+ }
|
||||
+ return id;
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Throws if any of the mandatory fields is not set.
|
||||
*
|
||||
@@ -2009,7 +2022,8 @@ public final class ShortcutInfo implements Parcelable {
|
||||
final ClassLoader cl = getClass().getClassLoader();
|
||||
|
||||
mUserId = source.readInt();
|
||||
- mId = source.readString();
|
||||
+ mId = getSafeId(Preconditions.checkStringNotEmpty(source.readString8(),
|
||||
+ "Shortcut ID must be provided"));
|
||||
mPackageName = source.readString();
|
||||
mActivity = source.readParcelable(cl);
|
||||
mFlags = source.readInt();
|
||||
diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java
|
||||
index fd3678dae0c4..18970322d854 100644
|
||||
--- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java
|
||||
+++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest2.java
|
||||
@@ -53,6 +53,7 @@ import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
+import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
@@ -223,6 +224,15 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
|
||||
});
|
||||
}
|
||||
|
||||
+ public void testShortcutIdTruncated() {
|
||||
+ ShortcutInfo si = new ShortcutInfo.Builder(getTestContext(),
|
||||
+ String.join("", Collections.nCopies(Short.MAX_VALUE, "s"))).build();
|
||||
+
|
||||
+ assertTrue(
|
||||
+ "id must be truncated to MAX_ID_LENGTH",
|
||||
+ si.getId().length() <= ShortcutInfo.MAX_ID_LENGTH);
|
||||
+ }
|
||||
+
|
||||
public void testShortcutInfoParcel() {
|
||||
setCaller(CALLING_PACKAGE_1, USER_10);
|
||||
ShortcutInfo si = parceled(new ShortcutInfo.Builder(mClientContext)
|
127
Patches/LineageOS-17.1/android_frameworks_base/360963.patch
Normal file
127
Patches/LineageOS-17.1/android_frameworks_base/360963.patch
Normal file
@ -0,0 +1,127 @@
|
||||
From c7abcb66259f6ffc57f4b378d14b1999576ada03 Mon Sep 17 00:00:00 2001
|
||||
From: Ioana Alexandru <aioana@google.com>
|
||||
Date: Thu, 27 Apr 2023 12:36:05 +0000
|
||||
Subject: [PATCH] Visit URIs in landscape/portrait custom remote views.
|
||||
|
||||
Bug: 277740848
|
||||
Test: atest RemoteViewsTest NotificationManagerServiceTest & tested with POC from bug
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:e8acb2f660bdb03616989852f9dbbf1726f8237e)
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:43e1ae4e0d408604b9e3c18ac0e9bf87529b92a8)
|
||||
Merged-In: I7d3d35df0ec38945019f71755bed8797b7af4517
|
||||
Change-Id: I7d3d35df0ec38945019f71755bed8797b7af4517
|
||||
---
|
||||
core/java/android/widget/RemoteViews.java | 6 ++
|
||||
.../src/android/widget/RemoteViewsTest.java | 64 +++++++++++++++++++
|
||||
2 files changed, 70 insertions(+)
|
||||
|
||||
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
|
||||
index a9b2c4df255f1..ec36b9ed578c6 100644
|
||||
--- a/core/java/android/widget/RemoteViews.java
|
||||
+++ b/core/java/android/widget/RemoteViews.java
|
||||
@@ -562,6 +562,12 @@ public void visitUris(@NonNull Consumer<Uri> visitor) {
|
||||
mActions.get(i).visitUris(visitor);
|
||||
}
|
||||
}
|
||||
+ if (mLandscape != null) {
|
||||
+ mLandscape.visitUris(visitor);
|
||||
+ }
|
||||
+ if (mPortrait != null) {
|
||||
+ mPortrait.visitUris(visitor);
|
||||
+ }
|
||||
}
|
||||
|
||||
private static void visitIconUri(Icon icon, @NonNull Consumer<Uri> visitor) {
|
||||
diff --git a/core/tests/coretests/src/android/widget/RemoteViewsTest.java b/core/tests/coretests/src/android/widget/RemoteViewsTest.java
|
||||
index 8cb7e1b95245e..46f2c0928fc3d 100644
|
||||
--- a/core/tests/coretests/src/android/widget/RemoteViewsTest.java
|
||||
+++ b/core/tests/coretests/src/android/widget/RemoteViewsTest.java
|
||||
@@ -20,6 +20,10 @@
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
+import static org.mockito.ArgumentMatchers.eq;
|
||||
+import static org.mockito.Mockito.spy;
|
||||
+import static org.mockito.Mockito.times;
|
||||
+import static org.mockito.Mockito.verify;
|
||||
|
||||
import android.app.ActivityOptions;
|
||||
import android.app.PendingIntent;
|
||||
@@ -29,6 +33,8 @@
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
+import android.graphics.drawable.Icon;
|
||||
+import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Binder;
|
||||
import android.os.Parcel;
|
||||
@@ -50,6 +56,7 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
+import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* Tests for RemoteViews.
|
||||
@@ -499,4 +506,61 @@ public ActivityOptions createSharedElementActivityOptions(
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ @Test
|
||||
+ public void visitUris() {
|
||||
+ RemoteViews views = new RemoteViews(mPackage, R.layout.remote_views_test);
|
||||
+
|
||||
+ final Uri imageUri = Uri.parse("content://media/image");
|
||||
+ final Icon icon1 = Icon.createWithContentUri("content://media/icon1");
|
||||
+ final Icon icon2 = Icon.createWithContentUri("content://media/icon2");
|
||||
+ final Icon icon3 = Icon.createWithContentUri("content://media/icon3");
|
||||
+ final Icon icon4 = Icon.createWithContentUri("content://media/icon4");
|
||||
+ views.setImageViewUri(R.id.image, imageUri);
|
||||
+ views.setTextViewCompoundDrawables(R.id.text, icon1, icon2, icon3, icon4);
|
||||
+
|
||||
+ Consumer<Uri> visitor = (Consumer<Uri>) spy(Consumer.class);
|
||||
+ views.visitUris(visitor);
|
||||
+ verify(visitor, times(1)).accept(eq(imageUri));
|
||||
+ verify(visitor, times(1)).accept(eq(icon1.getUri()));
|
||||
+ verify(visitor, times(1)).accept(eq(icon2.getUri()));
|
||||
+ verify(visitor, times(1)).accept(eq(icon3.getUri()));
|
||||
+ verify(visitor, times(1)).accept(eq(icon4.getUri()));
|
||||
+ }
|
||||
+
|
||||
+ @Test
|
||||
+ public void visitUris_separateOrientation() {
|
||||
+ final RemoteViews landscape = new RemoteViews(mPackage, R.layout.remote_views_test);
|
||||
+ final Uri imageUriL = Uri.parse("content://landscape/image");
|
||||
+ final Icon icon1L = Icon.createWithContentUri("content://landscape/icon1");
|
||||
+ final Icon icon2L = Icon.createWithContentUri("content://landscape/icon2");
|
||||
+ final Icon icon3L = Icon.createWithContentUri("content://landscape/icon3");
|
||||
+ final Icon icon4L = Icon.createWithContentUri("content://landscape/icon4");
|
||||
+ landscape.setImageViewUri(R.id.image, imageUriL);
|
||||
+ landscape.setTextViewCompoundDrawables(R.id.text, icon1L, icon2L, icon3L, icon4L);
|
||||
+
|
||||
+ final RemoteViews portrait = new RemoteViews(mPackage, 33);
|
||||
+ final Uri imageUriP = Uri.parse("content://portrait/image");
|
||||
+ final Icon icon1P = Icon.createWithContentUri("content://portrait/icon1");
|
||||
+ final Icon icon2P = Icon.createWithContentUri("content://portrait/icon2");
|
||||
+ final Icon icon3P = Icon.createWithContentUri("content://portrait/icon3");
|
||||
+ final Icon icon4P = Icon.createWithContentUri("content://portrait/icon4");
|
||||
+ portrait.setImageViewUri(R.id.image, imageUriP);
|
||||
+ portrait.setTextViewCompoundDrawables(R.id.text, icon1P, icon2P, icon3P, icon4P);
|
||||
+
|
||||
+ RemoteViews views = new RemoteViews(landscape, portrait);
|
||||
+
|
||||
+ Consumer<Uri> visitor = (Consumer<Uri>) spy(Consumer.class);
|
||||
+ views.visitUris(visitor);
|
||||
+ verify(visitor, times(1)).accept(eq(imageUriL));
|
||||
+ verify(visitor, times(1)).accept(eq(icon1L.getUri()));
|
||||
+ verify(visitor, times(1)).accept(eq(icon2L.getUri()));
|
||||
+ verify(visitor, times(1)).accept(eq(icon3L.getUri()));
|
||||
+ verify(visitor, times(1)).accept(eq(icon4L.getUri()));
|
||||
+ verify(visitor, times(1)).accept(eq(imageUriP));
|
||||
+ verify(visitor, times(1)).accept(eq(icon1P.getUri()));
|
||||
+ verify(visitor, times(1)).accept(eq(icon2P.getUri()));
|
||||
+ verify(visitor, times(1)).accept(eq(icon3P.getUri()));
|
||||
+ verify(visitor, times(1)).accept(eq(icon4P.getUri()));
|
||||
+ }
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: "Nate(Qiang) Jiang" <qiangjiang@google.com>
|
||||
Date: Thu, 13 Apr 2023 19:25:51 +0000
|
||||
Subject: [PATCH] DO NOT MERGE: Add pre-share key check for wapi
|
||||
|
||||
Bug: 275339978
|
||||
Test: atest com.androi.server.wifi
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:07d112fb45449e06233b71e877e835084c76f220)
|
||||
Merged-In: Ibd3ee52c5993a541abb7b373e4052091d13e9c4f
|
||||
Change-Id: Ibd3ee52c5993a541abb7b373e4052091d13e9c4f
|
||||
---
|
||||
.../server/wifi/WifiConfigurationUtil.java | 4 ++
|
||||
.../wifi/WifiConfigurationUtilTest.java | 41 +++++++++++++++++++
|
||||
2 files changed, 45 insertions(+)
|
||||
|
||||
diff --git a/service/java/com/android/server/wifi/WifiConfigurationUtil.java b/service/java/com/android/server/wifi/WifiConfigurationUtil.java
|
||||
index b8992a011..2bb7b0dd2 100644
|
||||
--- a/service/java/com/android/server/wifi/WifiConfigurationUtil.java
|
||||
+++ b/service/java/com/android/server/wifi/WifiConfigurationUtil.java
|
||||
@@ -701,6 +701,10 @@ public class WifiConfigurationUtil {
|
||||
&& !validatePassword(config.preSharedKey, isAdd, false)) {
|
||||
return false;
|
||||
}
|
||||
+ if (config.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.WAPI_PSK)
|
||||
+ && !validatePassword(config.preSharedKey, isAdd, false)) {
|
||||
+ return false;
|
||||
+ }
|
||||
if (config.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.OWE)) {
|
||||
// PMF mandatory for OWE networks
|
||||
if (!config.requirePMF) {
|
||||
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java
|
||||
index 7173dae5b..aaa3f2605 100644
|
||||
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java
|
||||
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java
|
||||
@@ -352,6 +352,18 @@ public class WifiConfigurationUtilTest {
|
||||
assertFalse(WifiConfigurationUtil.validate(config, WifiConfigurationUtil.VALIDATE_FOR_ADD));
|
||||
}
|
||||
|
||||
+ @Test
|
||||
+ public void testValidateNegativeCases_BadAsciiPskLengthWapi() {
|
||||
+ WifiConfiguration config = WifiConfigurationTestUtil.createWapiPskNetwork();
|
||||
+ assertTrue(WifiConfigurationUtil.validate(config, WifiConfigurationUtil.VALIDATE_FOR_ADD));
|
||||
+
|
||||
+ config.preSharedKey = "\"abcdffeeretretyetreteteteabe34tetrertertrsraaaaaaaaaaa345eqwrweewq"
|
||||
+ + "weqe\"";
|
||||
+ assertFalse(WifiConfigurationUtil.validate(config, WifiConfigurationUtil.VALIDATE_FOR_ADD));
|
||||
+ config.preSharedKey = "\"454\"";
|
||||
+ assertFalse(WifiConfigurationUtil.validate(config, WifiConfigurationUtil.VALIDATE_FOR_ADD));
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Verify that the validate method fails to validate WifiConfiguration with bad sae length.
|
||||
*/
|
||||
@@ -380,6 +392,15 @@ public class WifiConfigurationUtilTest {
|
||||
assertFalse(WifiConfigurationUtil.validate(config, WifiConfigurationUtil.VALIDATE_FOR_ADD));
|
||||
}
|
||||
|
||||
+ @Test
|
||||
+ public void testValidateNegativeCases_MalformedAsciiPskStringWapi() {
|
||||
+ WifiConfiguration config = WifiConfigurationTestUtil.createWapiPskNetwork();
|
||||
+ assertTrue(WifiConfigurationUtil.validate(config, WifiConfigurationUtil.VALIDATE_FOR_ADD));
|
||||
+
|
||||
+ config.preSharedKey = "\"abcdfefeeretrety";
|
||||
+ assertFalse(WifiConfigurationUtil.validate(config, WifiConfigurationUtil.VALIDATE_FOR_ADD));
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Verify that the validate method fails to validate WifiConfiguration with malformed sae
|
||||
* string.
|
||||
@@ -407,6 +428,17 @@ public class WifiConfigurationUtilTest {
|
||||
assertFalse(WifiConfigurationUtil.validate(config, WifiConfigurationUtil.VALIDATE_FOR_ADD));
|
||||
}
|
||||
|
||||
+ @Test
|
||||
+ public void testValidateNegativeCases_BadHexPskLengthWapi() {
|
||||
+ WifiConfiguration config = WifiConfigurationTestUtil.createWapiPskNetwork();
|
||||
+ assertTrue(WifiConfigurationUtil.validate(config, WifiConfigurationUtil.VALIDATE_FOR_ADD));
|
||||
+
|
||||
+ config.preSharedKey = "abcd123456788990013453445345465465476546";
|
||||
+ assertFalse(WifiConfigurationUtil.validate(config, WifiConfigurationUtil.VALIDATE_FOR_ADD));
|
||||
+ config.preSharedKey = "";
|
||||
+ assertFalse(WifiConfigurationUtil.validate(config, WifiConfigurationUtil.VALIDATE_FOR_ADD));
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Verify that the validate method fails to validate WifiConfiguration with malformed psk
|
||||
* string.
|
||||
@@ -420,6 +452,15 @@ public class WifiConfigurationUtilTest {
|
||||
assertFalse(WifiConfigurationUtil.validate(config, WifiConfigurationUtil.VALIDATE_FOR_ADD));
|
||||
}
|
||||
|
||||
+ @Test
|
||||
+ public void testValidateNegativeCases_MalformedHexPskStringWapi() {
|
||||
+ WifiConfiguration config = WifiConfigurationTestUtil.createWapiPskNetwork();
|
||||
+ assertTrue(WifiConfigurationUtil.validate(config, WifiConfigurationUtil.VALIDATE_FOR_ADD));
|
||||
+
|
||||
+ config.preSharedKey = "adbdfgretrtyrtyrty";
|
||||
+ assertFalse(WifiConfigurationUtil.validate(config, WifiConfigurationUtil.VALIDATE_FOR_ADD));
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Verify that the validate method fails to validate WifiConfiguration with malformed sae
|
||||
* string.
|
45
Patches/LineageOS-17.1/android_system_bt/360969.patch
Normal file
45
Patches/LineageOS-17.1/android_system_bt/360969.patch
Normal file
@ -0,0 +1,45 @@
|
||||
From 785e4f3712e63acb5cb0b0d028609fcc268b9b78 Mon Sep 17 00:00:00 2001
|
||||
From: tyiu <tyiu@google.com>
|
||||
Date: Tue, 28 Mar 2023 18:40:51 +0000
|
||||
Subject: [PATCH] Fix gatt_end_operation buffer overflow
|
||||
|
||||
Added boundary check for gatt_end_operation to prevent writing out of
|
||||
boundary.
|
||||
|
||||
Since response of the GATT server is handled in
|
||||
gatt_client_handle_server_rsp() and gatt_process_read_rsp(), the maximum
|
||||
lenth that can be passed into the handlers is bounded by
|
||||
GATT_MAX_MTU_SIZE, which is set to 517, which is greater than
|
||||
GATT_MAX_ATTR_LEN which is set to 512. The fact that there is no spec
|
||||
that gaurentees MTU response to be less than or equal to 512 bytes can
|
||||
cause a buffer overflow when performing memcpy without length check.
|
||||
|
||||
Bug: 261068592
|
||||
Test: No test since not affecting behavior
|
||||
Tag: #security
|
||||
Ignore-AOSP-First: security
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:dd7298e982e4bbf0138a490562679c9a4a755200)
|
||||
Merged-In: I49e2797cd9300ee4cd69f2c7fa5f0073db78b873
|
||||
Change-Id: I49e2797cd9300ee4cd69f2c7fa5f0073db78b873
|
||||
---
|
||||
stack/gatt/gatt_utils.cc | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/stack/gatt/gatt_utils.cc b/stack/gatt/gatt_utils.cc
|
||||
index 2bd42400013..013011778b0 100644
|
||||
--- a/stack/gatt/gatt_utils.cc
|
||||
+++ b/stack/gatt/gatt_utils.cc
|
||||
@@ -1198,6 +1198,13 @@ void gatt_end_operation(tGATT_CLCB* p_clcb, tGATT_STATUS status, void* p_data) {
|
||||
cb_data.att_value.handle = p_clcb->s_handle;
|
||||
cb_data.att_value.len = p_clcb->counter;
|
||||
|
||||
+ if (cb_data.att_value.len > GATT_MAX_ATTR_LEN) {
|
||||
+ LOG(WARNING) << __func__
|
||||
+ << StringPrintf(" Large cb_data.att_value, size=%d",
|
||||
+ cb_data.att_value.len);
|
||||
+ cb_data.att_value.len = GATT_MAX_ATTR_LEN;
|
||||
+ }
|
||||
+
|
||||
if (p_data && p_clcb->counter)
|
||||
memcpy(cb_data.att_value.value, p_data, cb_data.att_value.len);
|
||||
}
|
34
Patches/LineageOS-17.1/android_system_nfc/360972.patch
Normal file
34
Patches/LineageOS-17.1/android_system_nfc/360972.patch
Normal file
@ -0,0 +1,34 @@
|
||||
From ce05a2670c9ceb76b6ff5715d25331f2c59ddab6 Mon Sep 17 00:00:00 2001
|
||||
From: Alisher Alikhodjaev <alisher@google.com>
|
||||
Date: Tue, 2 May 2023 14:20:57 -0700
|
||||
Subject: [PATCH] OOBW in rw_i93_send_to_upper()
|
||||
|
||||
Bug: 271849189
|
||||
Test: tag r/w
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:dc9d09e1698725712628d394bf9be4c9003579e8)
|
||||
Merged-In: I1d55954e56a3f995f8dd48bf484fe9fce02b2ed1
|
||||
Change-Id: I1d55954e56a3f995f8dd48bf484fe9fce02b2ed1
|
||||
---
|
||||
src/nfc/tags/rw_i93.cc | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/src/nfc/tags/rw_i93.cc b/src/nfc/tags/rw_i93.cc
|
||||
index 1c64ea84..cb6d96da 100644
|
||||
--- a/src/nfc/tags/rw_i93.cc
|
||||
+++ b/src/nfc/tags/rw_i93.cc
|
||||
@@ -578,6 +578,15 @@ void rw_i93_send_to_upper(NFC_HDR* p_resp) {
|
||||
case I93_CMD_GET_MULTI_BLK_SEC:
|
||||
case I93_CMD_EXT_GET_MULTI_BLK_SEC:
|
||||
|
||||
+ if (UINT16_MAX - length < NFC_HDR_SIZE) {
|
||||
+ rw_data.i93_cmd_cmpl.status = NFC_STATUS_FAILED;
|
||||
+ rw_data.i93_cmd_cmpl.command = p_i93->sent_cmd;
|
||||
+ rw_cb.tcb.i93.sent_cmd = 0;
|
||||
+
|
||||
+ event = RW_I93_CMD_CMPL_EVT;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
/* forward tag data or security status */
|
||||
p_buff = (NFC_HDR*)GKI_getbuf((uint16_t)(length + NFC_HDR_SIZE));
|
||||
|
1456
Patches/LineageOS-17.1/android_tools_apksig/360973-backport.patch
Normal file
1456
Patches/LineageOS-17.1/android_tools_apksig/360973-backport.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,57 @@
|
||||
From 17cb7edf8ad3aa239f39e4b823e881284f789343 Mon Sep 17 00:00:00 2001
|
||||
From: Alisher Alikhodjaev <alisher@google.com>
|
||||
Date: Tue, 2 May 2023 14:20:57 -0700
|
||||
Subject: [PATCH] OOBW in rw_i93_send_to_upper()
|
||||
|
||||
Bug: 271849189
|
||||
Test: tag r/w
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:dc9d09e1698725712628d394bf9be4c9003579e8)
|
||||
Merged-In: I1d55954e56a3f995f8dd48bf484fe9fce02b2ed1
|
||||
Change-Id: I1d55954e56a3f995f8dd48bf484fe9fce02b2ed1
|
||||
|
||||
Change-Id: Ia10491e388a495a164462c73ced7ea1965808860
|
||||
---
|
||||
SN100x/src/nfc/tags/rw_i93.cc | 9 +++++++++
|
||||
src/nfc/tags/rw_i93.cc | 9 +++++++++
|
||||
2 files changed, 18 insertions(+)
|
||||
|
||||
diff --git a/SN100x/src/nfc/tags/rw_i93.cc b/SN100x/src/nfc/tags/rw_i93.cc
|
||||
index f57ee763..062cc7e8 100755
|
||||
--- a/SN100x/src/nfc/tags/rw_i93.cc
|
||||
+++ b/SN100x/src/nfc/tags/rw_i93.cc
|
||||
@@ -598,6 +598,15 @@ void rw_i93_send_to_upper(NFC_HDR* p_resp) {
|
||||
case I93_CMD_GET_MULTI_BLK_SEC:
|
||||
case I93_CMD_EXT_GET_MULTI_BLK_SEC:
|
||||
|
||||
+ if (UINT16_MAX - length < NFC_HDR_SIZE) {
|
||||
+ rw_data.i93_cmd_cmpl.status = NFC_STATUS_FAILED;
|
||||
+ rw_data.i93_cmd_cmpl.command = p_i93->sent_cmd;
|
||||
+ rw_cb.tcb.i93.sent_cmd = 0;
|
||||
+
|
||||
+ event = RW_I93_CMD_CMPL_EVT;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
/* forward tag data or security status */
|
||||
p_buff = (NFC_HDR*)GKI_getbuf((uint16_t)(length + NFC_HDR_SIZE));
|
||||
|
||||
diff --git a/src/nfc/tags/rw_i93.cc b/src/nfc/tags/rw_i93.cc
|
||||
index f47fc30c..f58d7f58 100644
|
||||
--- a/src/nfc/tags/rw_i93.cc
|
||||
+++ b/src/nfc/tags/rw_i93.cc
|
||||
@@ -598,6 +598,15 @@ void rw_i93_send_to_upper(NFC_HDR* p_resp) {
|
||||
case I93_CMD_GET_MULTI_BLK_SEC:
|
||||
case I93_CMD_EXT_GET_MULTI_BLK_SEC:
|
||||
|
||||
+ if (UINT16_MAX - length < NFC_HDR_SIZE) {
|
||||
+ rw_data.i93_cmd_cmpl.status = NFC_STATUS_FAILED;
|
||||
+ rw_data.i93_cmd_cmpl.command = p_i93->sent_cmd;
|
||||
+ rw_cb.tcb.i93.sent_cmd = 0;
|
||||
+
|
||||
+ event = RW_I93_CMD_CMPL_EVT;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
/* forward tag data or security status */
|
||||
p_buff = (NFC_HDR*)GKI_getbuf((uint16_t)(length + NFC_HDR_SIZE));
|
||||
|
@ -0,0 +1,45 @@
|
||||
From 35912b629815d6481deabe9fcbebac83722367a6 Mon Sep 17 00:00:00 2001
|
||||
From: tyiu <tyiu@google.com>
|
||||
Date: Tue, 28 Mar 2023 18:40:51 +0000
|
||||
Subject: [PATCH] Fix gatt_end_operation buffer overflow
|
||||
|
||||
Added boundary check for gatt_end_operation to prevent writing out of
|
||||
boundary.
|
||||
|
||||
Since response of the GATT server is handled in
|
||||
gatt_client_handle_server_rsp() and gatt_process_read_rsp(), the maximum
|
||||
lenth that can be passed into the handlers is bounded by
|
||||
GATT_MAX_MTU_SIZE, which is set to 517, which is greater than
|
||||
GATT_MAX_ATTR_LEN which is set to 512. The fact that there is no spec
|
||||
that gaurentees MTU response to be less than or equal to 512 bytes can
|
||||
cause a buffer overflow when performing memcpy without length check.
|
||||
|
||||
Bug: 261068592
|
||||
Test: No test since not affecting behavior
|
||||
Tag: #security
|
||||
Ignore-AOSP-First: security
|
||||
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:dd7298e982e4bbf0138a490562679c9a4a755200)
|
||||
Merged-In: I49e2797cd9300ee4cd69f2c7fa5f0073db78b873
|
||||
Change-Id: I49e2797cd9300ee4cd69f2c7fa5f0073db78b873
|
||||
---
|
||||
stack/gatt/gatt_utils.cc | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/stack/gatt/gatt_utils.cc b/stack/gatt/gatt_utils.cc
|
||||
index 291cd1062..eb2a12dbc 100644
|
||||
--- a/stack/gatt/gatt_utils.cc
|
||||
+++ b/stack/gatt/gatt_utils.cc
|
||||
@@ -1198,6 +1198,13 @@ void gatt_end_operation(tGATT_CLCB* p_clcb, tGATT_STATUS status, void* p_data) {
|
||||
cb_data.att_value.handle = p_clcb->s_handle;
|
||||
cb_data.att_value.len = p_clcb->counter;
|
||||
|
||||
+ if (cb_data.att_value.len > GATT_MAX_ATTR_LEN) {
|
||||
+ LOG(WARNING) << __func__
|
||||
+ << StringPrintf(" Large cb_data.att_value, size=%d",
|
||||
+ cb_data.att_value.len);
|
||||
+ cb_data.att_value.len = GATT_MAX_ATTR_LEN;
|
||||
+ }
|
||||
+
|
||||
if (p_data && p_clcb->counter)
|
||||
memcpy(cb_data.att_value.value, p_data, cb_data.att_value.len);
|
||||
}
|
@ -97,6 +97,7 @@ sed -i '75i$(my_res_package): PRIVATE_AAPT_FLAGS += --auto-add-overlay' core/aap
|
||||
awk -i inplace '!/updatable_apex.mk/' target/product/mainline_system.mk; #Disable APEX
|
||||
sed -i 's/PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION := 23/PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION := 28/' core/version_defaults.mk; #Set the minimum supported target SDK to Pie (GrapheneOS)
|
||||
#sed -i 's/PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS := true/PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS := false/' core/product_config.mk; #broken by hardenDefconfig
|
||||
sed -i 's/2023-06-05/2023-07-05/' core/version_defaults.mk; #Bump Security String #R_asb_2023-07 #XXX
|
||||
fi;
|
||||
|
||||
if enterAndClear "build/soong"; then
|
||||
@ -118,6 +119,10 @@ if enterAndClear "external/conscrypt"; then
|
||||
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_external_conscrypt/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
|
||||
fi;
|
||||
|
||||
if enterAndClear "external/freetype"; then
|
||||
applyPatch "$DOS_PATCHES/android_external_freetype/360951.patch"; #R_asb_2023-07 Cherry-pick two upstream changes
|
||||
fi;
|
||||
|
||||
if [ "$DOS_GRAPHENE_MALLOC" = true ]; then
|
||||
if enterAndClear "external/hardened_malloc"; then
|
||||
applyPatch "$DOS_PATCHES/android_external_hardened_malloc/0001-Broken_Cameras.patch"; #Expand workaround to all camera executables (DivestOS)
|
||||
@ -136,6 +141,18 @@ git fetch https://github.com/LineageOS/android_external_zlib refs/changes/70/352
|
||||
fi;
|
||||
|
||||
if enterAndClear "frameworks/base"; then
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/360952-backport.patch"; #R_asb_2023-07 Passpoint Add more check to limit the config size
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/360953-backport.patch"; #R_asb_2023-07 Sanitize VPN label to prevent HTML injection
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/360954.patch"; #R_asb_2023-07 Limit the number of supported v1 and v2 signers
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/360955.patch"; #R_asb_2023-07 Import translations.
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/360956.patch"; #R_asb_2023-07 Add size check on PPS#policy
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/360957.patch"; #R_asb_2023-07 Limit the ServiceFriendlyNames
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/360958-backport.patch"; #R_asb_2023-07 Only allow NEW_TASK flag when adjusting pending intents
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/360959.patch"; #R_asb_2023-07 Dismiss keyguard when simpin auth'd and security method is none.
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/360960.patch"; #R_asb_2023-07 Increase notification channel limit.
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/360961-backport.patch"; #R_asb_2023-07 Verify URI permissions for EXTRA_REMOTE_INPUT_HISTORY_ITEMS.
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/360962-backport.patch"; #R_asb_2023-07 Truncate ShortcutInfo Id
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/360963.patch"; #R_asb_2023-07 Visit URIs in landscape/portrait custom remote views.
|
||||
#applyPatch "$DOS_PATCHES/android_frameworks_base/272645.patch"; #ten-bt-sbc-hd-dualchannel: Add CHANNEL_MODE_DUAL_CHANNEL constant (ValdikSS)
|
||||
#applyPatch "$DOS_PATCHES/android_frameworks_base/272646-forwardport.patch"; #ten-bt-sbc-hd-dualchannel: Add Dual Channel into Bluetooth Audio Channel Mode developer options menu (ValdikSS)
|
||||
#applyPatch "$DOS_PATCHES/android_frameworks_base/272647.patch"; #ten-bt-sbc-hd-dualchannel: Allow SBC as HD audio codec in Bluetooth device configuration (ValdikSS)
|
||||
@ -206,6 +223,7 @@ fi;
|
||||
fi;
|
||||
|
||||
if enterAndClear "frameworks/opt/net/wifi"; then
|
||||
#applyPatch "$DOS_PATCHES/android_frameworks_opt_net_wifi/360964-backport.patch"; #R_asb_2023-07 Add pre-share key check for wapi #XXX
|
||||
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_frameworks_opt_net_wifi/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_opt_net_wifi/0002-Random_MAC.patch"; #Add support for always generating new random MAC (GrapheneOS)
|
||||
fi;
|
||||
@ -364,12 +382,17 @@ applyPatch "$DOS_PATCHES/android_prebuilts_abi-dumps_vndk/0001-protobuf-avi.patc
|
||||
fi;
|
||||
|
||||
if enterAndClear "system/bt"; then
|
||||
applyPatch "$DOS_PATCHES/android_system_bt/360969.patch"; #R_asb_2023-07 Fix gatt_end_operation buffer overflow
|
||||
applyPatch "$DOS_PATCHES_COMMON/android_system_bt/0001-alloc_size.patch"; #Add alloc_size attributes to the allocator (GrapheneOS)
|
||||
#applyPatch "$DOS_PATCHES/android_system_bt/272648.patch"; #ten-bt-sbc-hd-dualchannel: Increase maximum Bluetooth SBC codec bitrate for SBC HD (ValdikSS)
|
||||
#applyPatch "$DOS_PATCHES/android_system_bt/272649.patch"; #ten-bt-sbc-hd-dualchannel: Explicit SBC Dual Channel (SBC HD) support (ValdikSS)
|
||||
#applyPatch "$DOS_PATCHES/android_system_bt/272650.patch"; #ten-bt-sbc-hd-dualchannel: Allow using alternative (higher) SBC HD bitrates with a property (ValdikSS)
|
||||
fi;
|
||||
|
||||
if enterAndClear "vendor/qcom/opensource/commonsys/system/bt"; then
|
||||
applyPatch "$DOS_PATCHES/android_vendor_qcom_opensource_commonsys_system_bt/360975.patch"; #R_asb_2023-07 Fix gatt_end_operation buffer overflow
|
||||
fi;
|
||||
|
||||
if enterAndClear "system/ca-certificates"; then
|
||||
rm -rf files; #Remove old certs
|
||||
cp -r "$DOS_PATCHES_COMMON/android_system_ca-certificates/files" .; #Copy the new ones into place
|
||||
@ -394,6 +417,14 @@ applyPatch "$DOS_PATCHES/android_system_netd/0001-Network_Permission.patch"; #Ex
|
||||
applyPatch "$DOS_PATCHES/android_system_netd/0002-hosts_toggle.patch"; #Add a toggle to disable /etc/hosts lookup (DivestOS)
|
||||
fi;
|
||||
|
||||
if enterAndClear "system/nfc"; then
|
||||
applyPatch "$DOS_PATCHES/android_system_nfc/360972.patch"; #R_asb_2023-07 OOBW in rw_i93_send_to_upper()
|
||||
fi;
|
||||
|
||||
if enterAndClear "vendor/nxp/opensource/commonsys/external/libnfc-nci"; then
|
||||
applyPatch "$DOS_PATCHES/android_vendor_nxp_opensource_commonsys_external_libnfc-nci/360974.patch"; #R_asb_2023-07 OOBW in rw_i93_send_to_upper()
|
||||
fi;
|
||||
|
||||
if enterAndClear "system/sepolicy"; then
|
||||
applyPatch "$DOS_PATCHES/android_system_sepolicy/0002-protected_files.patch"; #label protected_{fifos,regular} as proc_security (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES/android_system_sepolicy/0003-ptrace_scope-1.patch"; #Allow init to control kernel.yama.ptrace_scope (GrapheneOS)
|
||||
@ -410,6 +441,10 @@ if enterAndClear "system/update_engine"; then
|
||||
git revert --no-edit c68499e3ff10f2a31f913e14f66aafb4ed94d42d; #Do not skip payload signature verification
|
||||
fi;
|
||||
|
||||
if enterAndClear "tools/apksig"; then
|
||||
applyPatch "$DOS_PATCHES/android_tools_apksig/360973-backport.patch"; #R_asb_2023-07 Limit the number of supported v1 and v2 signers
|
||||
fi;
|
||||
|
||||
if enterAndClear "vendor/lineage"; then
|
||||
rm build/target/product/security/lineage.x509.pem; #Remove Lineage keys
|
||||
rm -rf overlay/common/lineage-sdk/packages/LineageSettingsProvider/res/values/defaults.xml; #Remove analytics
|
||||
|
Loading…
Reference in New Issue
Block a user