Merge pull request #2042 from keepassxreboot/fix/passkeys_use_hostname

Passkeys: Use hostname instead of host
This commit is contained in:
Sami Vänttinen 2023-11-28 18:18:38 +02:00 committed by GitHub
commit 2ea6f08235
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,9 +46,9 @@ kpxcPasskeysUtils.buildCredentialCreationOptions = function(pkOptions) {
}
if (!pkOptions.rp.id) {
pkOptions.rp.id = window.location.host;
pkOptions.rp.name = window.location.host;
} else if (!window.location.host.endsWith(pkOptions.rp.id)) {
pkOptions.rp.id = window.location.hostname;
pkOptions.rp.name = window.location.hostname;
} else if (!window.location.hostname.endsWith(pkOptions.rp.id)) {
throw new DOMException('Site domain differs from RP ID', DOMException.SecurityError);
}
@ -102,8 +102,8 @@ kpxcPasskeysUtils.buildCredentialRequestOptions = function(pkOptions) {
checkErrors(pkOptions);
if (!pkOptions.rpId) {
pkOptions.rpId = window.location.host;
} else if (!window.location.host.endsWith(pkOptions.rpId)) {
pkOptions.rpId = window.location.hostname;
} else if (!window.location.hostname.endsWith(pkOptions.rpId)) {
throw new DOMException('Site domain differs from RP ID', DOMException.SecurityError);
}