Commit a968c110 authored by Scott Kirkwood's avatar Scott Kirkwood Committed by Commit Bot

Remove the check for mapslite being 1p GoogleSigned.

Bug: 778790
Change-Id: Ia3a7cc1d6be3f22e963a6fc3446b0d14a8c7bd4d
Reviewed-on: https://chromium-review.googlesource.com/742288Reviewed-by: default avatarXi Han <hanxi@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Commit-Queue: Scott Kirkwood <scottkirkwood@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512942}
parent 86b18513
...@@ -14,7 +14,6 @@ import org.chromium.base.ThreadUtils; ...@@ -14,7 +14,6 @@ import org.chromium.base.ThreadUtils;
import org.chromium.base.annotations.SuppressFBWarnings; import org.chromium.base.annotations.SuppressFBWarnings;
import org.chromium.base.library_loader.LibraryLoader; import org.chromium.base.library_loader.LibraryLoader;
import org.chromium.chrome.browser.ChromeVersionInfo; import org.chromium.chrome.browser.ChromeVersionInfo;
import org.chromium.chrome.browser.externalauth.ExternalAuthUtils;
import org.chromium.webapk.lib.client.WebApkIdentityServiceClient; import org.chromium.webapk.lib.client.WebApkIdentityServiceClient;
import org.chromium.webapk.lib.client.WebApkValidator; import org.chromium.webapk.lib.client.WebApkValidator;
...@@ -24,15 +23,9 @@ import org.chromium.webapk.lib.client.WebApkValidator; ...@@ -24,15 +23,9 @@ import org.chromium.webapk.lib.client.WebApkValidator;
public class ChromeWebApkHost { public class ChromeWebApkHost {
private static ApplicationStatus.ApplicationStateListener sListener; private static ApplicationStatus.ApplicationStateListener sListener;
private static class SignatureChecker implements WebApkValidator.ISignatureChecker {
public boolean isGoogleSigned(String packageName) {
return ExternalAuthUtils.getInstance().isGoogleSigned(packageName);
}
}
public static void init() { public static void init() {
WebApkValidator.init(ChromeWebApkHostSignature.EXPECTED_SIGNATURE, WebApkValidator.init(ChromeWebApkHostSignature.EXPECTED_SIGNATURE,
ChromeWebApkHostSignature.PUBLIC_KEY, new SignatureChecker()); ChromeWebApkHostSignature.PUBLIC_KEY);
if (ChromeVersionInfo.isLocalBuild() if (ChromeVersionInfo.isLocalBuild()
&& CommandLine.getInstance().hasSwitch(SKIP_WEBAPK_VERIFICATION)) { && CommandLine.getInstance().hasSwitch(SKIP_WEBAPK_VERIFICATION)) {
// Tell the WebApkValidator to work for all WebAPKs. // Tell the WebApkValidator to work for all WebAPKs.
......
...@@ -72,18 +72,11 @@ public class WebApkValidatorTest { ...@@ -72,18 +72,11 @@ public class WebApkValidatorTest {
private RobolectricPackageManager mPackageManager; private RobolectricPackageManager mPackageManager;
private static boolean sIsGoogleSignedResult = true;
private class FakeIsGoogleValidator implements WebApkValidator.ISignatureChecker {
public boolean isGoogleSigned(String packageName) {
return sIsGoogleSignedResult;
}
}
@Before @Before
public void setUp() { public void setUp() {
mPackageManager = mPackageManager =
(RobolectricPackageManager) RuntimeEnvironment.application.getPackageManager(); (RobolectricPackageManager) RuntimeEnvironment.application.getPackageManager();
WebApkValidator.init(EXPECTED_SIGNATURE, PUBLIC_KEY, new FakeIsGoogleValidator()); WebApkValidator.init(EXPECTED_SIGNATURE, PUBLIC_KEY);
} }
/** /**
...@@ -268,15 +261,16 @@ public class WebApkValidatorTest { ...@@ -268,15 +261,16 @@ public class WebApkValidatorTest {
public void testIsValidWebApkForMapsLite() { public void testIsValidWebApkForMapsLite() {
mPackageManager.addPackage(newPackageInfoWithBrowserSignature( mPackageManager.addPackage(newPackageInfoWithBrowserSignature(
MAPSLITE_PACKAGE_NAME, new Signature(SIGNATURE_1), MAPSLITE_EXAMPLE_STARTURL)); MAPSLITE_PACKAGE_NAME, new Signature(SIGNATURE_1), MAPSLITE_EXAMPLE_STARTURL));
mPackageManager.addPackage(
newPackageInfoWithBrowserSignature(MAPSLITE_PACKAGE_NAME + ".other",
new Signature(SIGNATURE_1), MAPSLITE_EXAMPLE_STARTURL));
sIsGoogleSignedResult = true;
assertTrue(WebApkValidator.isValidWebApk( assertTrue(WebApkValidator.isValidWebApk(
RuntimeEnvironment.application, MAPSLITE_PACKAGE_NAME)); RuntimeEnvironment.application, MAPSLITE_PACKAGE_NAME));
assertFalse(WebApkValidator.isValidWebApk( assertFalse(WebApkValidator.isValidWebApk(
RuntimeEnvironment.application, MAPSLITE_PACKAGE_NAME + ".other")); RuntimeEnvironment.application, MAPSLITE_PACKAGE_NAME + ".other"));
sIsGoogleSignedResult = false;
assertFalse(WebApkValidator.isValidWebApk( assertFalse(WebApkValidator.isValidWebApk(
RuntimeEnvironment.application, MAPSLITE_PACKAGE_NAME)); RuntimeEnvironment.application, MAPSLITE_PACKAGE_NAME + ".notfound"));
} }
/** /**
......
...@@ -46,13 +46,9 @@ public class WebApkValidator { ...@@ -46,13 +46,9 @@ public class WebApkValidator {
private static byte[] sExpectedSignature; private static byte[] sExpectedSignature;
private static byte[] sCommentSignedPublicKeyBytes; private static byte[] sCommentSignedPublicKeyBytes;
private static ISignatureChecker sSignatureChecker;
private static PublicKey sCommentSignedPublicKey; private static PublicKey sCommentSignedPublicKey;
private static boolean sOverrideValidationForTesting; private static boolean sOverrideValidationForTesting;
/** Interface to support callback to verify if a goole package name is Google signed. */
public interface ISignatureChecker { public boolean isGoogleSigned(String packageName); }
/** /**
* Queries the PackageManager to determine whether a WebAPK can handle the URL. Ignores whether * Queries the PackageManager to determine whether a WebAPK can handle the URL. Ignores whether
* the user has selected a default handler for the URL and whether the default handler is the * the user has selected a default handler for the URL and whether the default handler is the
...@@ -239,14 +235,6 @@ public class WebApkValidator { ...@@ -239,14 +235,6 @@ public class WebApkValidator {
Log.d(TAG, "mapslite invalid scope prefix"); Log.d(TAG, "mapslite invalid scope prefix");
return false; return false;
} }
if (sSignatureChecker == null) {
Log.d(TAG, "sSignatureChecker not set");
return false;
}
if (!sSignatureChecker.isGoogleSigned(webappPackageName)) {
Log.d(TAG, "mapslite not Google signed");
return false;
}
return true; return true;
} }
...@@ -319,17 +307,13 @@ public class WebApkValidator { ...@@ -319,17 +307,13 @@ public class WebApkValidator {
* @param v2PublicKeyBytes New comment signed public key bytes as x509 encoded public key. * @param v2PublicKeyBytes New comment signed public key bytes as x509 encoded public key.
*/ */
@SuppressFBWarnings("EI_EXPOSE_STATIC_REP2") @SuppressFBWarnings("EI_EXPOSE_STATIC_REP2")
public static void init(byte[] expectedSignature, byte[] v2PublicKeyBytes, public static void init(byte[] expectedSignature, byte[] v2PublicKeyBytes) {
ISignatureChecker googleSignedCallback) {
if (sExpectedSignature == null) { if (sExpectedSignature == null) {
sExpectedSignature = expectedSignature; sExpectedSignature = expectedSignature;
} }
if (sCommentSignedPublicKeyBytes == null) { if (sCommentSignedPublicKeyBytes == null) {
sCommentSignedPublicKeyBytes = v2PublicKeyBytes; sCommentSignedPublicKeyBytes = v2PublicKeyBytes;
} }
if (sSignatureChecker == null) {
sSignatureChecker = googleSignedCallback;
}
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment