1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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>
|