x/net/publicsuffix: ICANN flag returned not aligned with public suffix location in the list #22985
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
The text was updated successfully, but these errors were encountered:
I think this behavior is expected at least from the perspective of the official PSL repo.
Build 7 which has change:
results in failure.
Build 8 which has change:
results in success.
Build 9 which has change:
results in success.
Note that there were no other changes between these builds. Compare the cases here: https://github.com/meirf/list/blob/master/tests/tests.txt#L40-L49, note the pattern of
Thanks for bringing it to the attention.
At first glance, I'd say the match should be against
However, it's interesting we don't have a proper test case.
I also checked it against 2 libraries I maintain. The Go lib matches against the
I'll bring this issue to the PSL list to make sure the interpretation is correct and make sure we address it.
I believe this is the source of the confusion.
From the formal algorithm:
Emphasis is mine. It means, given two rules:
If you try to match
In other words, in case the rule contains
should all match
I think this is one of those cases where it's worth to invest some effort on the PSL side to reach a consensus and standardize all the implementations. I am definitely bringing it up for discussion (I'll add a reference to the ticker and/or thread here).
@weppos I doubt that this reading is correct.
*.example.be has three labels. From right to left these are "be", "example" and "*".
example.be has two labels: "be" and "example"
So the domain example.be can never match the rule *.example.be because the domain has fewer labels than the rule. The * is a label; it is not "a label or no label".
While trying to fix this bug I found one more thing I think is underspecified:
What is the icann flag for "bd"? There is just one rule for bd:
(the rule is in the ICANN section).
With the official PSL algorithm the domain "be" would not match the rule ".bd"
(Note: The strange rule "*.bd" seems to be a "fix" for some test case break.
Where the later with the explicit rule for "bd" seems saner.