getcredential-badargs-rpid.https.html (1902B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>WebAuthn credential.get() rpId Tests</title> 4 <meta name="timeout" content="long"> 5 <link rel="author" title="Adam Powers" href="mailto:adam@fidoalliance.org"> 6 <link rel="help" href="https://w3c.github.io/webauthn/#iface-credential"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script src="/resources/testdriver.js"></script> 10 <script src="/resources/testdriver-vendor.js"></script> 11 <script src=helpers.js></script> 12 <body></body> 13 <script> 14 standardSetup(function() { 15 "use strict"; 16 17 var credPromise = createCredential(); 18 19 new GetCredentialsTest("options.publicKey.rpId", "") 20 .addCredential(credPromise) 21 .runTest("Bad rpId: empty string", "SecurityError"); 22 new GetCredentialsTest("options.publicKey.rpId", null) 23 .addCredential(credPromise) 24 .runTest("Bad rpId: null", "SecurityError"); 25 new GetCredentialsTest("options.publicKey.rpId", "invalid domain.com") 26 .addCredential(credPromise) 27 .runTest("Bad rpId: invalid domain (has space)", "SecurityError"); 28 new GetCredentialsTest("options.publicKey.rpId", "-invaliddomain.com") 29 .addCredential(credPromise) 30 .runTest("Bad rpId: invalid domain (starts with dash)", "SecurityError"); 31 new GetCredentialsTest("options.publicKey.rpId", "0invaliddomain.com") 32 .addCredential(credPromise) 33 .runTest("Bad rpId: invalid domain (starts with number)", "SecurityError"); 34 35 let hostAndPort = window.location.host; 36 if (!hostAndPort.match(/:\d+$/)) { 37 hostAndPort += ":443"; 38 } 39 new GetCredentialsTest({path: "options.publicKey.rpId", value: hostAndPort}) 40 .addCredential(credPromise) 41 .runTest("Bad rpId: host + port", "SecurityError"); 42 }); 43 44 /* JSHINT */ 45 /* globals standardSetup, GetCredentialsTest, createCredential */ 46 </script>