[DO NOT MERGE] passpoint: validate decorated identity prefix
Bug: 246539931
Test: atest FrameworksWifiTests
insatll PoC to verify the issue does not happen
Change-Id: I59144c43d2ee9590c8d973e24877e56aaf395b33
(cherry picked from commit df9d477011d9e64857dea3658cba1fc25e5d18cc)
diff --git a/framework/java/android/net/wifi/hotspot2/PasspointConfiguration.java b/framework/java/android/net/wifi/hotspot2/PasspointConfiguration.java
index 375c9fb..239f406 100644
--- a/framework/java/android/net/wifi/hotspot2/PasspointConfiguration.java
+++ b/framework/java/android/net/wifi/hotspot2/PasspointConfiguration.java
@@ -37,6 +37,7 @@
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
+import android.util.EventLog;
import android.util.Log;
import androidx.annotation.RequiresApi;
@@ -952,6 +953,13 @@
if (mPolicy != null && !mPolicy.validate()) {
return false;
}
+ // Optional: DecoratedIdentityPrefix
+ if (!TextUtils.isEmpty(mDecoratedIdentityPrefix)
+ && !mDecoratedIdentityPrefix.endsWith("!")) {
+ EventLog.writeEvent(0x534e4554, "246539931", -1,
+ "Invalid decorated identity prefix");
+ return false;
+ }
if (mTrustRootCertList != null) {
for (Map.Entry<String, byte[]> entry : mTrustRootCertList.entrySet()) {