fix(webauthn): validate rp.id as a registrable domain suffix (fix #187)#190
Merged
Conversation
4 tasks
msirringhaus
approved these changes
May 11, 2026
Collaborator
msirringhaus
left a comment
There was a problem hiding this comment.
LGTM overall!
We might want to add a note to the README that the publicsuffix-package is needed on the system during runtime?
81861b5 to
806107f
Compare
7faa08f to
c57ce4f
Compare
Member
Author
|
Thanks @msirringhaus! Updated README. I also opened #210 because it seems that Fedora comes with the PSL in DAFSA file format (binary) by default, not plaintext. Debian should be fine as is. Adding an extra parser shouldn't be much work. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #187. Stacked on #188.
What
Replaces the strict-equality check between the JSON request's
rp.idand the origin's effective domain with the spec-correct "registrable domain suffix of or equal to" relation from HTML §6.5 (referenced by WebAuthn L3 §5.1.3 step 7 and §5.1.7 step 9).Net effect:
rp.id = "example.org"now works against an origin ofhttps://login.example.org, whilerp.id = "co.uk"againsthttps://example.co.ukis still correctly rejected becauseco.ukis a public suffix.PSL strategy
Per the design discussion in #173 (libwebauthn should not bundle and manage its own PSL):
PublicSuffixListtrait with syncregistrable_domain/public_suffixmethods.DatFilePublicSuffixListimpl that reads a Public Suffix List.datfile at construction time.from_system_file()reads the standard/usr/share/publicsuffix/public_suffix_list.dat, kept current by the system package manager.publicsuffix = "1.5". Same crate as Implement #160 Related Origins support (WebAuthn L3 § 5.11) #173, just used offline.Plumbing into the parsing API
WebAuthnIDL::from_jsonandFromIdlModel::from_idl_modelnow take an additionalpsl: &dyn PublicSuffixListparameter. This is the simplest shape we discussed - explicit, no hidden state onRequestOrigin. Yes, it's another breaking signature change on top of #188; the 0.4.0 release is already breaking, so we eat the cost once.Origin parsing (
Origin::from_str,RequestOrigin::try_from) stays purely syntactic. PSL is only consulted at validation time.Commits
PublicSuffixListtrait andDatFilePublicSuffixListimpl.PublicSuffixListfor the registrable-suffix check infrom_idl_model.Tests
MockPublicSuffixList(recognisescom,co.uk,org,net).from_jsonfor bothMakeCredentialRequestandGetAssertionRequest: rp.id-as-parent-registrable-suffix accepted, rp.id-as-eTLD rejected.Test plan
cargo build --workspace --all-targets --all-featurescargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspace(151 tests)cargo publish --dry-run -p libwebauthn