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
Родитель 4e49b34cac
Коммит b3f09128c0
20 изменённых файлов: 43 добавлений и 64 удалений

Просмотреть файл

@ -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()));

Просмотреть файл

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

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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()) {

Просмотреть файл

@ -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)),

Просмотреть файл

@ -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,

Просмотреть файл

@ -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}],

Просмотреть файл

@ -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}],

Просмотреть файл

@ -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}],

Просмотреть файл

@ -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}],

Просмотреть файл

@ -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}],
};

Просмотреть файл

@ -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,

Просмотреть файл

@ -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"),

Просмотреть файл

@ -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]

Просмотреть файл

@ -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}],

Просмотреть файл

@ -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 = {};
});

Просмотреть файл

@ -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"};

Просмотреть файл

@ -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 = {

Просмотреть файл

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

Просмотреть файл

@ -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