Repository navigation
Fix PSL longest match when a wildcard shares a label with a longer rule - #2750
Merged
Merged
Conversation
- Root cause: the trie lookup prefers an exact edge over '*'. When the exact label only exists as part of a longer rule (e.g. `*.futurecms.at` next to `*.ex.futurecms.at`), the walk never records the `*.futurecms.at` match: `ex.futurecms.at` got suffix `at` instead of `ex.futurecms.at` (22 hosts, private section only). - Fix (build time only): exact siblings of '*' that aren't rules inherit the '*' rule's flag. Lookup code unchanged; only tldts trie data changes. - Tests: affected hosts in all option modes, builder unit tests, and a PSL check for the one unsupported shape (exact rule beside '*' of the other section). Reported-by: arkark (https://github.com/arkark)
remusao
force-pushed
the
fix-psl-longest-match
branch
from
November 12, 2026 09:25
12e413e to
13f8612
Compare
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.
Fix PSL longest match when a wildcard shares a label with a longer rule
With
allowPrivateDomains: true,tldtscould return a shorter public suffix than the PSL requires.*. When the exact label only exists as part of a longer rule (*.futurecms.atnext to*.ex.futurecms.at), the*.futurecms.atmatch was never recorded:ex.futurecms.at→atinstead ofex.futurecms.at. 22 hosts in today's list are affected, all in the private section.tldts-icannandtldts-experimentalaren't affected.*that aren't rules inherit the*rule's flag. The lookup code is unchanged; only thetldtstrie data changes (+1 node).*rule of the other section).Verified: 0 mismatches against a naive PSL-spec reference over 321k hostnames × 3 option modes. Fuzzing old vs new (10M lookups): every changed result is spec-required. Benchmarks are unchanged (the runtime code is identical).
Reported by @arkark.