summaryrefslogtreecommitdiffstats
path: root/dom/u2f/tests/frame_appid_facet_subdomain.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /dom/u2f/tests/frame_appid_facet_subdomain.html
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/u2f/tests/frame_appid_facet_subdomain.html')
-rw-r--r--dom/u2f/tests/frame_appid_facet_subdomain.html84
1 files changed, 84 insertions, 0 deletions
diff --git a/dom/u2f/tests/frame_appid_facet_subdomain.html b/dom/u2f/tests/frame_appid_facet_subdomain.html
new file mode 100644
index 0000000000..e2f44341f9
--- /dev/null
+++ b/dom/u2f/tests/frame_appid_facet_subdomain.html
@@ -0,0 +1,84 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<head>
+ <script type="text/javascript" src="frame_utils.js"></script>
+ <script type="text/javascript" src="u2futil.js"></script>
+</head>
+<body>
+<p>AppID / FacetID behavior check for subdomain processing</p>
+<script class="testbody" type="text/javascript">
+"use strict";
+
+async function doTests() {
+ var version = "U2F_V2";
+ var challenge = new Uint8Array(16);
+
+ local_is(window.location.origin, "https://test1.example.com", "Is loaded correctly");
+
+ // same domain check
+ await promiseU2FRegister("https://test1.example.com/appId", [{
+ version,
+ challenge: bytesToBase64UrlSafe(challenge),
+ }], [], function(res){
+ local_is(res.errorCode, 0, "AppID should work from a different path of this domain");
+ });
+
+ // same domain check, but wrong scheme
+ await promiseU2FRegister("http://test1.example.com/appId", [{
+ version,
+ challenge: bytesToBase64UrlSafe(challenge),
+ }], [], function(res){
+ local_isnot(res.errorCode, 0, "AppID should not work when using a different scheme");
+ });
+
+ // eTLD+1 subdomain check
+ await promiseU2FRegister("https://example.com/appId", [{
+ version,
+ challenge: bytesToBase64UrlSafe(challenge),
+ }], [], function(res){
+ // Changed in Bug 1244959 to behave like W3C Web Authentication
+ local_is(res.errorCode, 0, "AppID should work from another subdomain in this registered domain");
+ });
+
+ // sub-subdomain check
+ await promiseU2FRegister("https://sub.test1.example.com/appId", [{
+ version,
+ challenge: bytesToBase64UrlSafe(challenge),
+ }], [], function(res){
+ // Changed in Bug 1244959 to behave like W3C Web Authentication
+ local_is(res.errorCode, 0, "AppID should work from a sub-subdomain");
+ });
+
+ // sub-subdomain check
+ await promiseU2FRegister("https://test2.example.com/appId", [{
+ version,
+ challenge: bytesToBase64UrlSafe(challenge),
+ }], [], function(res){
+ // Changed in Bug 1244959 to behave like W3C Web Authentication
+ local_is(res.errorCode, 0, "AppID should work from another subdomain of the eTLD+1");
+ });
+
+ // other domain check
+ await promiseU2FRegister("https://mochi.test:8888/appId", [{
+ version,
+ challenge: bytesToBase64UrlSafe(challenge),
+ }], [], function(res){
+ local_isnot(res.errorCode, 0, "AppID should not work from other domains");
+ });
+
+ // TLD check
+ await promiseU2FRegister("https://com:8888/appId", [{
+ version,
+ challenge: bytesToBase64UrlSafe(challenge),
+ }], [], function(res){
+ local_isnot(res.errorCode, 0, "AppID should not work from the eTLD itself");
+ });
+
+ local_finished();
+};
+
+doTests();
+
+</script>
+</body>
+</html>