Skip to content
Snippets Groups Projects
Commit 53ca7bda authored by John Schanck's avatar John Schanck Committed by Beatriz Rizental
Browse files

Bug 1922357 - disallow the fido: URI scheme. a=dmeehan

parent 94cb5008
Branches
Tags
1 merge request!1527Bug 43808: Rebase 128.10.1 onto 128.11
......@@ -1818,7 +1818,7 @@ class GeckoEngineSession(
internal const val ABOUT_BLANK = "about:blank"
internal const val JS_SCHEME = "javascript"
internal val BLOCKED_SCHEMES =
listOf("file", "resource", JS_SCHEME) // See 1684761 and 1684947
listOf("file", "resource", "fido", JS_SCHEME) // See 1684761 and 1684947
/**
* Provides an ErrorType corresponding to the error code provided.
......
......@@ -631,6 +631,11 @@ class GeckoEngineSessionTest {
engineSession.loadUrl("RESOURCE://package/test.text")
verify(geckoSession, never()).load(GeckoSession.Loader().uri("resource://package/test.text"))
verify(geckoSession, never()).load(GeckoSession.Loader().uri("RESOURCE://package/test.text"))
engineSession.loadUrl("fido:/12345678")
engineSession.loadUrl("FIDO:/12345678")
verify(geckoSession, never()).load(GeckoSession.Loader().uri("fido:/12345678"))
verify(geckoSession, never()).load(GeckoSession.Loader().uri("FIDO:/12345678"))
}
@Test
......
......@@ -313,6 +313,7 @@ class AppLinksUseCases(
"https", "moz-extension", "moz-safe-about", "resource", "view-source", "ws", "wss", "blob",
)
internal val ALWAYS_DENY_SCHEMES: Set<String> = setOf("jar", "file", "javascript", "data", "about", "content")
internal val ALWAYS_DENY_SCHEMES: Set<String> =
setOf("jar", "file", "javascript", "data", "about", "content", "fido")
}
}
......@@ -47,6 +47,7 @@ class AppLinksUseCasesTest {
private val javascriptUrl = "javascript:'hello, world'"
private val jarUrl = "jar:file://some/path/test.html"
private val contentUrl = "content://media/external_primary/downloads/12345"
private val fidoPath = "fido:12345678"
private val fileType = "audio/mpeg"
private val layerUrl = "https://example.com"
private val layerPackage = "com.example.app"
......@@ -215,6 +216,15 @@ class AppLinksUseCasesTest {
assertFalse(redirect.isRedirect())
}
@Test
fun `A fido url is not an app link`() {
val context = createContext(Triple(fidoPath, appPackage, ""))
val subject = AppLinksUseCases(context, { true })
val redirect = subject.interceptedAppLinkRedirect(fidoPath)
assertFalse(redirect.isRedirect())
}
@Test
fun `Will not redirect app link if browser option set to false and scheme is supported`() {
val context = createContext(Triple(appUrl, appPackage, ""))
......
......@@ -76,6 +76,10 @@ public class IntentUtils {
return getSafeIntent(aUri) != null;
}
if ("fido".equals(scheme)) {
return false;
}
return true;
}
......
......@@ -63,4 +63,10 @@ public class IntentUtilsTest {
final String uri = "intent:non_scheme_intent#Intent;end";
assertTrue(IntentUtils.isUriSafeForScheme(uri));
}
@Test
public void unsafeFidoUri() {
final String uri = "fido:/12345678";
assertFalse(IntentUtils.isUriSafeForScheme(uri));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment