fix(creation-profiles): default rp.name to rp.id when empty (#893) - #896
Conversation
Removing the deprecated `webauthn.creation_profiles.*.rp.name` node, as the 5.3.0 deprecation message instructs, made the bundle emit `rp.name = ""`. Recent Chrome/Firefox builds tolerate the missing name, but SimpleWebAuthn's browser bindings (used by @web-auth/webauthn-stimulus) refuse to call `navigator.credentials.create()` when `rp.name` is empty (per W3C IDL it is required), so adding authenticators to existing users silently failed. PublicKeyCredentialCreationOptionsFactory now falls back to the configured `rp.id` whenever `rp.name` is empty, mirroring the fix shipped in #889 for the 5.4 helper API.
* 5.3.x: fix(creation-profiles): default rp.name to rp.id when empty (#893) (#896) feat(stimulus): ship TypeScript type declarations (.d.ts) for the npm package (#895) fix(origins): accept non-URL facet IDs (e.g. android:apk-key-hash:...) in allowed origins (#894) # Conflicts: # src/stimulus/assets/src/authentication-controller.js # src/stimulus/assets/src/base-controller.js # src/stimulus/assets/src/controller.js
|
@Spomky Thank you for fix this on the 5.3.x. Another issue I found is current deprecation message is misleading for developer to use the web-auth/webauthn-lib inaccurately. The deprecation message: For the PublicKeyCredentialRpEntity.name, the empty string What do you think correcting the deprecation message to set PublicKeyCredentialRpEntity.name the PublicKeyCredentialRpEntity.id like this PR does? Otherwise, I think we could remove it first and add this deprecation back in future to avoid the current misleading which may break some systems. |
Hi @Spomky , Could you please take a look? |
Summary
Refs #893 (the framework side; the documentation legs are tracked in web-auth/doc#57, web-auth/doc#58 and web-auth/doc#59).
Per W3C IDL,
PublicKeyCredentialEntity.nameis required:dictionary PublicKeyCredentialEntity { required DOMString name; };The 5.3.0 release deprecated the
webauthn.creation_profiles.*.rp.nameconfiguration node. When users follow the deprecation message and remove the node, the configuration default falls back to'', soPublicKeyCredentialCreationOptionsFactory::createRpEntityproduced{"rp": {"name": "", "id": "..."}}.Recent Chrome / Firefox builds tolerate the empty name and fall back to the eTLD+1, but SimpleWebAuthn's browser bindings (
@simplewebauthn/browser@13.x, pulled in by@web-auth/webauthn-stimulus@5.3.x) refuse to callnavigator.credentials.create()whenrp.nameis empty: the registration silently fails after the options endpoint returns 200.Fix
When the configured
rp.nameis an empty string, fall back to therp.id. The id is a human-readable hostname and is therefore a sensible default display label, and the JSON now always carries a non-empty name.This mirrors the equivalent fix on the 5.4 helper API in #889.
BC
Strictly additive on the runtime serialisation side: profiles that still configure a non-empty
rp.nameare unchanged, and the deprecated node keeps emitting the same deprecation warning at config-build time.