Commit e66320c5 authored by Nina Satragno's avatar Nina Satragno Committed by Commit Bot

[webauthn] Clean up CreateCredential WPTs

Remove web platform tests that erroneously expect failures for
converting objects like arrays into dictionaries and other values into
booleans. The webauthn spec does not impose any such restrictions and
the ECMAScript spec precisely specifies how those values are converted.

Bug: 875444
Change-Id: I8c131735808205313314b9043da7e775a51dd9b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2086253
Commit-Queue: Nina Satragno <nsatragno@chromium.org>
Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746888}
parent 9245ccb4
This is a testharness.js-based test.
FAIL Bad AuthenticatorSelectionCriteria: authenticatorSelection is empty array assert_unreached: Should have rejected: Expected bad parameters to fail Reached unreachable code
FAIL Bad AuthenticatorSelectionCriteria: authenticatorSelection is null assert_unreached: Should have rejected: Expected bad parameters to fail Reached unreachable code
PASS Bad AuthenticatorSelectionCriteria: authenticatorSelection is empty string
PASS Bad AuthenticatorSelectionCriteria: authenticatorSelection is string
PASS Bad AuthenticatorSelectionCriteria: authenticatorSelection attachment is empty string
PASS Bad AuthenticatorSelectionCriteria: authenticatorSelection attachment is empty object
PASS Bad AuthenticatorSelectionCriteria: authenticatorSelection attachment is null
PASS Bad AuthenticatorSelectionCriteria: authenticatorSelection attachment platform
PASS Bad AuthenticatorSelectionCriteria: authenticatorSelection residentKey true
FAIL Bad AuthenticatorSelectionCriteria: authenticatorSelection residentKey is string promise_rejects_js: Expected bad parameters to fail function "function() { throw e }" threw object "NotAllowedError: The operation either timed out or was not allowed. See: https://w3c.github.io/webauthn/#sec-assertion-privacy." ("NotAllowedError") expected instance of function "function TypeError() { [native code] }" ("TypeError")
PASS Bad AuthenticatorSelectionCriteria: authenticatorSelection userVerification empty string
PASS Bad AuthenticatorSelectionCriteria: authenticatorSelection userVerification empty object
PASS Bad AuthenticatorSelectionCriteria: authenticatorSelection userVerification bad value
PASS Bad AuthenticatorSelectionCriteria: authenticatorSelection userVerification null
PASS Bad AuthenticatorSelectionCriteria: authenticatorSelection userVerification required
PASS Clean up the test environment
Harness: the test ran to completion.
...@@ -46,8 +46,6 @@ standardSetup(function() { ...@@ -46,8 +46,6 @@ standardSetup(function() {
authnrSelBadUvNull.userVerification = null; authnrSelBadUvNull.userVerification = null;
// authenticatorSelection bad values // authenticatorSelection bad values
new CreateCredentialsTest("options.publicKey.authenticatorSelection", []).runTest("Bad AuthenticatorSelectionCriteria: authenticatorSelection is empty array", TypeError);
new CreateCredentialsTest("options.publicKey.authenticatorSelection", null).runTest("Bad AuthenticatorSelectionCriteria: authenticatorSelection is null", TypeError);
new CreateCredentialsTest("options.publicKey.authenticatorSelection", "").runTest("Bad AuthenticatorSelectionCriteria: authenticatorSelection is empty string", TypeError); new CreateCredentialsTest("options.publicKey.authenticatorSelection", "").runTest("Bad AuthenticatorSelectionCriteria: authenticatorSelection is empty string", TypeError);
new CreateCredentialsTest("options.publicKey.authenticatorSelection", "none").runTest("Bad AuthenticatorSelectionCriteria: authenticatorSelection is string", TypeError); new CreateCredentialsTest("options.publicKey.authenticatorSelection", "none").runTest("Bad AuthenticatorSelectionCriteria: authenticatorSelection is string", TypeError);
...@@ -65,10 +63,6 @@ standardSetup(function() { ...@@ -65,10 +63,6 @@ standardSetup(function() {
new CreateCredentialsTest("options.publicKey.authenticatorSelection", authnrSelRkTrue) new CreateCredentialsTest("options.publicKey.authenticatorSelection", authnrSelRkTrue)
.modify("options.publicKey.timeout", 300) .modify("options.publicKey.timeout", 300)
.runTest("Bad AuthenticatorSelectionCriteria: authenticatorSelection residentKey true", "NotAllowedError"); .runTest("Bad AuthenticatorSelectionCriteria: authenticatorSelection residentKey true", "NotAllowedError");
new CreateCredentialsTest("options.publicKey.authenticatorSelection", authnrSelRkBadString)
.modify("options.publicKey.timeout", 300)
.runTest("Bad AuthenticatorSelectionCriteria: authenticatorSelection residentKey is string", TypeError);
// TODO: not sure if rk is "boolean" or "truthy"; add test cases if it should only accept boolean values
// authenticatorSelection bad userVerification values // authenticatorSelection bad userVerification values
new CreateCredentialsTest("options.publicKey.authenticatorSelection", authnrSelBadUvEmptyStr).runTest("Bad AuthenticatorSelectionCriteria: authenticatorSelection userVerification empty string", TypeError); new CreateCredentialsTest("options.publicKey.authenticatorSelection", authnrSelBadUvEmptyStr).runTest("Bad AuthenticatorSelectionCriteria: authenticatorSelection userVerification empty string", TypeError);
......
This is a testharness.js-based test.
PASS Bad rp: rp missing
PASS Bad rp: rp null
PASS Bad rp: rp is string
PASS Bad rp: rp is empty object
FAIL Bad rp: id is object promise_rejects_js: Expected bad parameters to fail function "function() { throw e }" threw object "SecurityError: The relying party ID is not a registrable domain suffix of, nor equal to the current domain." ("SecurityError") expected instance of function "function TypeError() { [native code] }" ("TypeError")
PASS Bad rp: id is null
PASS Bad rp: id is empty String
PASS Bad rp: id is invalid domain (has space)
PASS Bad rp: id is invalid domain (starts with dash)
PASS Bad rp: id is invalid domain (starts with number)
PASS rp missing name
FAIL Bad rp: name is object assert_unreached: Should have rejected: Expected bad parameters to fail Reached unreachable code
FAIL Bad rp: name is null assert_unreached: Should have rejected: Expected bad parameters to fail Reached unreachable code
FAIL Bad rp: name is empty String assert_unreached: Should have rejected: Expected bad parameters to fail Reached unreachable code
FAIL Bad rp: icon is object promise_rejects_js: Expected bad parameters to fail function "function() { throw e }" threw object "SecurityError: 'rp.icon' should be a secure URL" ("SecurityError") expected instance of function "function TypeError() { [native code] }" ("TypeError")
FAIL Bad rp: icon is null promise_rejects_js: Expected bad parameters to fail function "function() { throw e }" threw object "SecurityError: 'rp.icon' should be a secure URL" ("SecurityError") expected instance of function "function TypeError() { [native code] }" ("TypeError")
FAIL Bad rp: icon is empty String assert_unreached: Should have rejected: Expected bad parameters to fail Reached unreachable code
PASS Bad rp: icon is insecure
PASS Clean up the test environment
Harness: the test ran to completion.
...@@ -21,7 +21,6 @@ standardSetup(function() { ...@@ -21,7 +21,6 @@ standardSetup(function() {
new CreateCredentialsTest("options.publicKey.rp", {}).runTest("Bad rp: rp is empty object", TypeError); new CreateCredentialsTest("options.publicKey.rp", {}).runTest("Bad rp: rp is empty object", TypeError);
// // rp.id // // rp.id
new CreateCredentialsTest("options.publicKey.rp.id", {}).runTest("Bad rp: id is object", TypeError);
new CreateCredentialsTest("options.publicKey.rp.id", null).runTest("Bad rp: id is null", "SecurityError"); new CreateCredentialsTest("options.publicKey.rp.id", null).runTest("Bad rp: id is null", "SecurityError");
new CreateCredentialsTest("options.publicKey.rp.id", "").runTest("Bad rp: id is empty String", "SecurityError"); new CreateCredentialsTest("options.publicKey.rp.id", "").runTest("Bad rp: id is empty String", "SecurityError");
new CreateCredentialsTest("options.publicKey.rp.id", "invalid domain.com").runTest("Bad rp: id is invalid domain (has space)", "SecurityError"); new CreateCredentialsTest("options.publicKey.rp.id", "invalid domain.com").runTest("Bad rp: id is invalid domain (has space)", "SecurityError");
...@@ -30,17 +29,10 @@ standardSetup(function() { ...@@ -30,17 +29,10 @@ standardSetup(function() {
// // rp.name // // rp.name
new CreateCredentialsTest({path: "options.publicKey.rp.name", value: undefined}).runTest("rp missing name", TypeError); new CreateCredentialsTest({path: "options.publicKey.rp.name", value: undefined}).runTest("rp missing name", TypeError);
new CreateCredentialsTest("options.publicKey.rp.name", {}).runTest("Bad rp: name is object", TypeError);
new CreateCredentialsTest("options.publicKey.rp.name", null).runTest("Bad rp: name is null", TypeError);
new CreateCredentialsTest("options.publicKey.rp.name", "").runTest("Bad rp: name is empty String", TypeError);
// // rp.icon // rp.icon
new CreateCredentialsTest("options.publicKey.rp.icon", {}).runTest("Bad rp: icon is object", TypeError);
new CreateCredentialsTest("options.publicKey.rp.icon", null).runTest("Bad rp: icon is null", TypeError);
new CreateCredentialsTest("options.publicKey.rp.icon", "").runTest("Bad rp: icon is empty String", TypeError);
new CreateCredentialsTest("options.publicKey.rp.icon", "http://fidoalliance.co.nz/testimages/catimage.png") new CreateCredentialsTest("options.publicKey.rp.icon", "http://fidoalliance.co.nz/testimages/catimage.png")
.runTest("Bad rp: icon is insecure", "SecurityError"); .runTest("Bad rp: icon is insecure", "SecurityError");
// // TODO: unicode tests for icon URL (see also: USVString)
}); });
/* JSHINT */ /* JSHINT */
......
This is a testharness.js-based test.
PASS Bad extensions: extensions is string
FAIL Bad extensions: extensions is null assert_unreached: Should have rejected: Expected bad parameters to fail Reached unreachable code
FAIL Bad extensions: extensions is empty Array assert_unreached: Should have rejected: Expected bad parameters to fail Reached unreachable code
FAIL Bad extensions: extensions is empty ArrayBuffer assert_unreached: Should have rejected: Expected bad parameters to fail Reached unreachable code
FAIL Bad extensions: malformatted JSON assert_unreached: Should have rejected: Expected bad parameters to fail Reached unreachable code
FAIL Bad extensions: JavaScript object assert_unreached: Should have rejected: Expected bad parameters to fail Reached unreachable code
FAIL Bad extensions: extension ID too long assert_unreached: Should have rejected: Expected bad parameters to fail Reached unreachable code
PASS extensions is a nonsensical JSON string
PASS empty appid in create request
PASS null appid in create request
PASS appid in create request
PASS Clean up the test environment
Harness: the test ran to completion.
...@@ -21,15 +21,6 @@ standardSetup(function() { ...@@ -21,15 +21,6 @@ standardSetup(function() {
// bad extension values // bad extension values
new CreateCredentialsTest("options.publicKey.extensions", "hi mom").runTest("Bad extensions: extensions is string", TypeError); new CreateCredentialsTest("options.publicKey.extensions", "hi mom").runTest("Bad extensions: extensions is string", TypeError);
new CreateCredentialsTest("options.publicKey.extensions", null).runTest("Bad extensions: extensions is null", TypeError);
new CreateCredentialsTest("options.publicKey.extensions", []).runTest("Bad extensions: extensions is empty Array", TypeError);
new CreateCredentialsTest("options.publicKey.extensions", new ArrayBuffer(0)).runTest("Bad extensions: extensions is empty ArrayBuffer", TypeError);
var badJson = '{"foo": true, "bar: "yup"}'; // missing quote after "bar"
new CreateCredentialsTest("options.publicKey.extensions", {foo: badJson}).runTest("Bad extensions: malformatted JSON", TypeError);
new CreateCredentialsTest("options.publicKey.extensions", {foo: dummyExtension}).runTest("Bad extensions: JavaScript object", TypeError);
var badExtId = {};
badExtId[createRandomString(65)] = dummyExtension;
new CreateCredentialsTest("options.publicKey.extensions", {badExtId: dummyExtension}).runTest("Bad extensions: extension ID too long", TypeError);
// phony extensions // phony extensions
// TODO: not sure if this should pass or fail // TODO: not sure if this should pass or fail
......
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