Bug 1813281 - remove icon field from PublicKeyCredentialEntity. r=keeler,webidl,geckoview-reviewers,smaug,owlish

Differential Revision: https://phabricator.services.mozilla.com/D186597
This commit is contained in:
John Schanck 2023-09-01 16:29:19 +00:00
parent 4e49b34cac
commit b3f09128c0
20 changed files with 43 additions and 64 deletions

View File

@ -197,12 +197,8 @@ RefPtr<U2FRegisterPromise> AndroidWebAuthnTokenManager::Register(
GECKOBUNDLE_PUT(credentialBundle, "rpName",
jni::StringParam(rp.Name()));
GECKOBUNDLE_PUT(credentialBundle, "rpIcon",
jni::StringParam(rp.Icon()));
GECKOBUNDLE_PUT(credentialBundle, "userName",
jni::StringParam(user.Name()));
GECKOBUNDLE_PUT(credentialBundle, "userIcon",
jni::StringParam(user.Icon()));
GECKOBUNDLE_PUT(credentialBundle, "userDisplayName",
jni::StringParam(user.DisplayName()));

View File

@ -61,13 +61,11 @@ union WebAuthnExtensionResult {
struct WebAuthnMakeCredentialRpInfo {
nsString Name;
nsString Icon;
};
struct WebAuthnMakeCredentialUserInfo {
uint8_t[] Id;
nsString Name;
nsString Icon;
nsString DisplayName;
};

View File

@ -426,20 +426,10 @@ already_AddRefed<Promise> WebAuthnManager::MakeCredential(
WebAuthnAuthenticatorSelection authSelection(
residentKey, selection.mUserVerification, authenticatorAttachment);
nsString rpIcon;
if (aOptions.mRp.mIcon.WasPassed()) {
rpIcon = aOptions.mRp.mIcon.Value();
}
WebAuthnMakeCredentialRpInfo rpInfo(aOptions.mRp.mName);
nsString userIcon;
if (aOptions.mUser.mIcon.WasPassed()) {
userIcon = aOptions.mUser.mIcon.Value();
}
WebAuthnMakeCredentialRpInfo rpInfo(aOptions.mRp.mName, rpIcon);
WebAuthnMakeCredentialUserInfo userInfo(
userId, aOptions.mUser.mName, userIcon, aOptions.mUser.mDisplayName);
WebAuthnMakeCredentialUserInfo userInfo(userId, aOptions.mUser.mName,
aOptions.mUser.mDisplayName);
BrowsingContext* context = mParent->GetBrowsingContext();
if (!context) {

View File

@ -216,12 +216,12 @@ void WinWebAuthnManager::Register(
DWORD winAttestation = WEBAUTHN_ATTESTATION_CONVEYANCE_PREFERENCE_ANY;
rpInfo.pwszName = aInfo.Rp().Name().get();
rpInfo.pwszIcon = aInfo.Rp().Icon().get();
rpInfo.pwszIcon = nullptr;
userInfo.cbId = static_cast<DWORD>(aInfo.User().Id().Length());
userInfo.pbId = const_cast<unsigned char*>(aInfo.User().Id().Elements());
userInfo.pwszName = aInfo.User().Name().get();
userInfo.pwszIcon = aInfo.User().Icon().get();
userInfo.pwszIcon = nullptr;
userInfo.pwszDisplayName = aInfo.User().DisplayName().get();
for (const auto& coseAlg : aInfo.coseAlgs()) {

View File

@ -67,11 +67,10 @@ function startMakeCredentialRequest(tab) {
const cose_alg_ECDSA_w_SHA256 = -7;
let publicKey = {
rp: { id: content.document.domain, name: "none", icon: "none" },
rp: { id: content.document.domain, name: "none" },
user: {
id: new Uint8Array(),
name: "none",
icon: "none",
displayName: "none",
},
challenge: content.crypto.getRandomValues(new Uint8Array(16)),

View File

@ -139,11 +139,10 @@ function promiseWebAuthnMakeCredential(
];
let publicKey = {
rp: { id: content.document.domain, name: "none", icon: "none" },
rp: { id: content.document.domain, name: "none" },
user: {
id: new Uint8Array(),
name: "none",
icon: "none",
displayName: "none",
},
pubKeyCredParams,

View File

@ -33,8 +33,8 @@
// Start a new MakeCredential() request.
function requestMakeCredential(signal) {
let publicKey = {
rp: {id: document.domain, name: "none", icon: "none"},
user: {id: new Uint8Array(), name: "none", icon: "none", displayName: "none"},
rp: {id: document.domain, name: "none"},
user: {id: new Uint8Array(), name: "none", displayName: "none"},
challenge: crypto.getRandomValues(new Uint8Array(16)),
timeout: 5000, // the minimum timeout is actually 15 seconds
pubKeyCredParams: [{type: "public-key", alg: cose_alg_ECDSA_w_SHA256}],

View File

@ -59,8 +59,8 @@
// Start a new MakeCredential() request.
function requestMakeCredential(attestation) {
let publicKey = {
rp: {id: document.domain, name: "none", icon: "none"},
user: {id: new Uint8Array(), name: "none", icon: "none", displayName: "none"},
rp: {id: document.domain, name: "none"},
user: {id: new Uint8Array(), name: "none", displayName: "none"},
challenge: crypto.getRandomValues(new Uint8Array(16)),
timeout: 5000, // the minimum timeout is actually 15 seconds
pubKeyCredParams: [{type: "public-key", alg: cose_alg_ECDSA_w_SHA256}],

View File

@ -38,8 +38,8 @@
// Start a new MakeCredential() request.
function requestMakeCredential(authenticatorSelection) {
let publicKey = {
rp: {id: document.domain, name: "none", icon: "none"},
user: {id: new Uint8Array(), name: "none", icon: "none", displayName: "none"},
rp: {id: document.domain, name: "none"},
user: {id: new Uint8Array(), name: "none", displayName: "none"},
challenge: crypto.getRandomValues(new Uint8Array(16)),
timeout: 5000, // the minimum timeout is actually 15 seconds
pubKeyCredParams: [{type: "public-key", alg: cose_alg_ECDSA_w_SHA256}],

View File

@ -41,8 +41,8 @@
// Start a new MakeCredential() request.
function requestMakeCredential(excludeCredentials) {
let publicKey = {
rp: {id: document.domain, name: "none", icon: "none"},
user: {id: new Uint8Array(), name: "none", icon: "none", displayName: "none"},
rp: {id: document.domain, name: "none"},
user: {id: new Uint8Array(), name: "none", displayName: "none"},
challenge: crypto.getRandomValues(new Uint8Array(16)),
timeout: 5000, // the minimum timeout is actually 15 seconds
pubKeyCredParams: [{type: "public-key", alg: cose_alg_ECDSA_w_SHA256}],

View File

@ -80,8 +80,8 @@
// Set up a valid credential
async function test_setup_valid_credential() {
let publicKey = {
rp: {id: document.domain, name: "none", icon: "none"},
user: {id: new Uint8Array(), name: "none", icon: "none", displayName: "none"},
rp: {id: document.domain, name: "none"},
user: {id: new Uint8Array(), name: "none", displayName: "none"},
challenge: crypto.getRandomValues(new Uint8Array(16)),
pubKeyCredParams: [{type: "public-key", alg: cose_alg_ECDSA_w_SHA256}],
};

View File

@ -115,8 +115,8 @@ add_task(async function() {
}
async function testMakeCredential() {
let rp = {id: document.domain, name: "none", icon: "none"};
let user = {id: new Uint8Array(), name: "none", icon: "none", displayName: "none"};
let rp = {id: document.domain, name: "none"};
let user = {id: new Uint8Array(), name: "none", displayName: "none"};
let param = {type: "public-key", alg: cose_alg_ECDSA_w_SHA256};
let makeCredentialOptions = {
rp,
@ -131,8 +131,8 @@ add_task(async function() {
}
async function testMakeDuplicate(aCredInfo) {
let rp = {id: document.domain, name: "none", icon: "none"};
let user = {id: new Uint8Array(), name: "none", icon: "none", displayName: "none"};
let rp = {id: document.domain, name: "none"};
let user = {id: new Uint8Array(), name: "none", displayName: "none"};
let param = {type: "public-key", alg: cose_alg_ECDSA_w_SHA256};
let makeCredentialOptions = {
rp,

View File

@ -40,8 +40,8 @@
gCredentialChallenge = new Uint8Array(16);
window.crypto.getRandomValues(gCredentialChallenge);
rp = {id: document.domain, name: "none", icon: "none"};
user = {id: new Uint8Array(64), name: "none", icon: "none", displayName: "none"};
rp = {id: document.domain, name: "none"};
user = {id: new Uint8Array(64), name: "none", displayName: "none"};
param = {type: "public-key", alg: cose_alg_ECDSA_w_SHA256};
unsupportedParam = {type: "public-key", alg: cose_alg_ECDSA_w_SHA512};
unknownParam = {type: "SimplePassword", alg: "MaxLength=2"};
@ -123,7 +123,7 @@
// Test without rp.name
async function test_without_rp_name() {
let rp1 = {id: document.domain, icon: "none"};
let rp1 = {id: document.domain};
let makeCredentialOptions = {
rp: rp1, user, challenge: gCredentialChallenge, pubKeyCredParams: [param]
};
@ -134,7 +134,7 @@
// Test without user.id
async function test_without_user_id() {
let user1 = {name: "none", icon: "none", displayName: "none"};
let user1 = {name: "none", displayName: "none"};
let makeCredentialOptions = {
rp, user: user1, challenge: gCredentialChallenge, pubKeyCredParams: [param]
};
@ -145,7 +145,7 @@
// Test without user.name
async function test_without_user_name() {
let user1 = {id: new Uint8Array(64), icon: "none", displayName: "none"};
let user1 = {id: new Uint8Array(64), displayName: "none"};
let makeCredentialOptions = {
rp, user: user1, challenge: gCredentialChallenge, pubKeyCredParams: [param]
};
@ -156,7 +156,7 @@
// Test without user.displayName
async function test_without_user_displayname() {
let user1 = {id: new Uint8Array(64), name: "none", icon: "none"};
let user1 = {id: new Uint8Array(64), name: "none"};
let makeCredentialOptions = {
rp, user: user1, challenge: gCredentialChallenge, pubKeyCredParams: [param]
};
@ -167,7 +167,7 @@
// Test with a user handle that exceeds the max length
async function test_user_too_large() {
let user1 = {id: new Uint8Array(65), name: "none", icon: "none", displayName: "none"};
let user1 = {id: new Uint8Array(65), name: "none", displayName: "none"};
let makeCredentialOptions = {
rp, user: user1, challenge: gCredentialChallenge, pubKeyCredParams: [param]
};
@ -289,7 +289,7 @@
// Test with an RP ID that is not a valid domain string
async function test_invalid_rp_id() {
let rp1 = { id: document.domain + ":somejunk", name: "none", icon: "none" };
let rp1 = { id: document.domain + ":somejunk", name: "none"};
let makeCredentialOptions = {
rp: rp1, user, challenge: gCredentialChallenge, pubKeyCredParams: [param]
};
@ -300,7 +300,7 @@
// Test with another RP ID that is not a valid domain string
async function test_invalid_rp_id_2() {
let rp1 = { id: document.domain + ":8888", name: "none", icon: "none" };
let rp1 = { id: document.domain + ":8888", name: "none"};
let makeCredentialOptions = {
rp: rp1, user, challenge: gCredentialChallenge, pubKeyCredParams: [param]
};
@ -321,7 +321,7 @@
// Test with incorrect user ID type
async function test_incorrect_user_id_type() {
let invalidType = {id: "a string, which is not a buffer", name: "none", icon: "none", displayName: "none"};
let invalidType = {id: "a string, which is not a buffer", name: "none", displayName: "none"};
let makeCredentialOptions = {
user: invalidType, challenge: gCredentialChallenge, pubKeyCredParams: [param]
};
@ -342,6 +342,7 @@
// Test a complete account
async function test_complete_account() {
// the icon fields are deprecated, but including them should not cause an error
let completeRP = {id: document.domain, name: "Foxxy Name",
icon: "https://example.com/fox.svg"};
let completeUser = {id: string2buffer("foxes_are_the_best@example.com"),
@ -361,7 +362,6 @@
async function test_too_large_user_id() {
let hugeUser = {id: new Uint8Array(65),
name: "Fox F. Foxington",
icon: "https://example.com/fox.svg",
displayName: "Foxxy V"};
let makeCredentialOptions = {
rp, user: hugeUser, challenge: gCredentialChallenge,
@ -374,11 +374,9 @@
// Test with excluding unknown transports
async function test_excluding_unknown_transports() {
let completeRP = {id: document.domain, name: "Foxxy Name",
icon: "https://example.com/fox.svg"};
let completeRP = {id: document.domain, name: "Foxxy Name"};
let completeUser = {id: string2buffer("foxes_are_the_best@example.com"),
name: "Fox F. Foxington",
icon: "https://example.com/fox.svg",
displayName: "Foxxy V"};
let excludedUnknownTransport = {type: "public-key",
id: string2buffer("123"),

View File

@ -45,8 +45,8 @@ add_task(async () => {
});
add_task(async function test_no_token_make_credential() {
let rp = {id: document.domain, name: "none", icon: "none"};
let user = {id: new Uint8Array(), name: "none", icon: "none", displayName: "none"};
let rp = {id: document.domain, name: "none"};
let user = {id: new Uint8Array(), name: "none", displayName: "none"};
let param = {type: "public-key", alg: cose_alg_ECDSA_w_SHA256};
let makeCredentialOptions = {
rp, user, challenge: credentialChallenge, pubKeyCredParams: [param]

View File

@ -27,8 +27,8 @@
// Start a new MakeCredential() request.
async function requestMakeCredential(status_value) {
let publicKey = {
rp: {id: document.domain, name: "none", icon: "none"},
user: {id: new Uint8Array(), name: "none", icon: "none", displayName: "none"},
rp: {id: document.domain, name: "none"},
user: {id: new Uint8Array(), name: "none", displayName: "none"},
challenge: crypto.getRandomValues(new Uint8Array(16)),
timeout: 5000, // the minimum timeout is actually 15 seconds
pubKeyCredParams: [{type: "public-key", alg: cose_alg_ECDSA_w_SHA256}],

View File

@ -38,7 +38,7 @@
chall = new Uint8Array(16);
window.crypto.getRandomValues(chall);
user = {id: new Uint8Array(16), name: "none", icon: "none", displayName: "none"};
user = {id: new Uint8Array(16), name: "none", displayName: "none"};
param = {type: "public-key", alg: cose_alg_ECDSA_w_SHA256};
gTrackedCredential = {};
});

View File

@ -63,7 +63,7 @@
let chall = new Uint8Array(16);
window.crypto.getRandomValues(chall);
let user = {id: new Uint8Array(16), name: "none", icon: "none", displayName: "none"};
let user = {id: new Uint8Array(16), name: "none", displayName: "none"};
let param = {type: "public-key", alg: cose_alg_ECDSA_w_SHA256};
let rp = {id: document.domain, name: "none"};

View File

@ -37,8 +37,8 @@
let credentialChallenge = new Uint8Array(16);
window.crypto.getRandomValues(credentialChallenge);
let rp = {id: document.domain, name: "none", icon: "none"};
let user = {id: new Uint8Array(64), name: "none", icon: "none", displayName: "none"};
let rp = {id: document.domain, name: "none"};
let user = {id: new Uint8Array(64), name: "none", displayName: "none"};
let params = [ {type: "public-key", alg: "es256"}, {type: "public-key", alg: -7} ]
let makeCredentialOptions = {

View File

@ -70,7 +70,6 @@ dictionary PublicKeyCredentialCreationOptions {
dictionary PublicKeyCredentialEntity {
required DOMString name;
USVString icon;
};
dictionary PublicKeyCredentialRpEntity : PublicKeyCredentialEntity {

View File

@ -168,7 +168,7 @@ import org.mozilla.gecko.util.GeckoBundle;
new PublicKeyCredentialUserEntity(
userId,
credentialBundle.getString("userName", ""),
credentialBundle.getString("userIcon", ""),
/* deprecated userIcon field */ "",
credentialBundle.getString("userDisplayName", ""));
AttestationConveyancePreference pref = AttestationConveyancePreference.NONE;
@ -227,7 +227,7 @@ import org.mozilla.gecko.util.GeckoBundle;
new PublicKeyCredentialRpEntity(
credentialBundle.getString("rpId"),
credentialBundle.getString("rpName", ""),
credentialBundle.getString("rpIcon", ""));
/* deprecated rpIcon field */ "");
final PublicKeyCredentialCreationOptions requestOptions =
requestBuilder