rockdaboot / libpsl

C library for the Public Suffix List

Home Page:https://rockdaboot.github.io/libpsl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Long valid suffixes are failing tests

aprex opened this issue · comments

Hi,
I'm working on adding few domains to the list. They are valid subdomain, but entries longer than 46 chars are failing tests. This prevents me from moving forward with submitting a PR to PSL repo.

I figured that it's caused by suffix label_buf being limited to the length 48 here:
https://github.com/rockdaboot/libpsl/blob/master/src/psl.c#L132

Due to that limit, suffixes are never added to psl in suffix_init method:
https://github.com/rockdaboot/libpsl/blob/master/src/psl.c#L310-L314

Examples of domains that fail check:

webview-assets.cloud9.cn-north-1.amazonaws.com.cn
webview-assets.cloud9.cn-northwest-1.amazonaws.com.cn
webview-assets.cloud9.ap-northeast-1.amazonaws.com
webview-assets.cloud9.ap-northeast-2.amazonaws.com
webview-assets.cloud9.ap-northeast-3.amazonaws.com
webview-assets.cloud9.ap-southeast-1.amazonaws.com
webview-assets.cloud9.ap-southeast-2.amazonaws.com
webview-assets.cloud9.ca-central-1.amazonaws.com
webview-assets.cloud9.eu-central-1.amazonaws.com

verylongsubdomainprefixfortest111.amazonaws.com
verylongsubdomainprefixfortest1111.amazonaws.com
verylongsubdomainprefixfortest11111.amazonaws.com

Tested by adding values to https://github.com/publicsuffix/list/blob/master/public_suffix_list.dat in checkout repo and running make test.

Is there reason for this limit and can it be increased? I can submit PR to change the limit if needed, but I want to clarify the context and what would be the correct value.

Hey 👋
I am currently afk, but don't remember any reasons for the limitation of 48 chars. Feel free to amend and I'll review in the next days.

Hi @aprex, just pushed a change to increase label_buf from 48 to 128. That should be enough for a while.

I guess the reason I once came up with 48 chars was that it is enough for everything inside the PSL and that it saves memory - at least its wa enough for a bunch of years 😆

128 characters might not be enough for certain IDNs, so some day we might have to increase that value again.

Please let me know if your problem is solved now. If so, I'll also tag a new release.

The change helped to solve the problem, thank you so much for quick feedback @rockdaboot