Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ipv6 local network filters #3

Closed
gwarser opened this issue May 31, 2020 · 6 comments
Closed

Add ipv6 local network filters #3

gwarser opened this issue May 31, 2020 · 6 comments

Comments

@gwarser
Copy link
Owner

gwarser commented May 31, 2020

uBlockOrigin/uBlock-issues#1070

What is still missing in my list is ipv6 handling https://en.wikipedia.org/wiki/Private_network#Private_IPv6_addresses. No one will scan these addresses from a to z, but some software can still be listening on one.

Calculator https://www.vultr.com/resources/subnet-calculator-ipv6/

  • fc00::/7 ranges from fc00:0000:0000:0000:0000:0000:0000:0000 to fdff:ffff:ffff:ffff:ffff:ffff:ffff:ffff

    ||[fc*]^
    ||[fd*]^

  • fd00::/8 should be included in above - fd00:0000:0000:0000:0000:0000:0000:0000 to fdff:ffff:ffff:ffff:ffff:ffff:ffff:ffff

  • legacy "site-local" fec0::/10 - fec0:0000:0000:0000:0000:0000:0000:0000 to feff:ffff:ffff:ffff:ffff:ffff:ffff:ffff

    ||[fec*]^
    ||[fed*]^
    ||[fee*]^
    ||[fef*]^

I'm not sure my filters above are actually valid or if these addresses can be so easily matched by simple text comparison with wildcard. Is [ and ] invalid in normal domain name? Someone with better knowledge about ipv6 address formatting will need to say. It may be good based on this: https://en.wikipedia.org/wiki/IPv6_address#Representation

@gwarser
Copy link
Owner Author

gwarser commented Jun 1, 2020

@gwarser gwarser changed the title Add ipv6 filters Add ipv6 local netwok filters Jun 1, 2020
@gwarser gwarser closed this as completed in 4547ea6 Jun 1, 2020
@gwarser gwarser added the LAN label Jun 1, 2020
@gwarser
Copy link
Owner Author

gwarser commented Jun 1, 2020

Hmmm, does it have the same issue as in #6 (comment) ?

[fc* can be [fc00:..., [fc0:..., [fc:....

@curiosityseeker
Copy link

I'm not an expert in these things at all. Just mentioning that the Behave add-on uses these rules. No idea if that's helpful for you ...

@gwarser
Copy link
Owner Author

gwarser commented Jul 6, 2020

Only this part is about ipv6 (^[fF][cCdD]) - this matches fc or fd and:

[fc* can be [fc00:..., [fc0:..., [fc:....

@gwarser
Copy link
Owner Author

gwarser commented Jul 7, 2020

/^https?://\[f(?:[cd][0-9a-f]{2}|e[c-f][0-9a-f]):[0-9a-f:]+\][:/]/$third-party,~websocket
/^wss?://\[f(?:[cd][0-9a-f]{2}|e[c-f][0-9a-f]):[0-9a-f:]+\][:/]/$third-party,websocket

https://regex101.com/r/O0tAKl/1

/^https?://\[f(?:[cd][0-9a-f]|e[c-f])[0-9a-f]:[0-9a-f:]+\][:/]/$third-party,~websocket
/^wss?://\[f(?:[cd][0-9a-f]|e[c-f])[0-9a-f]:[0-9a-f:]+\][:/]/$third-party,websocket

@gwarser
Copy link
Owner Author

gwarser commented Jul 7, 2020

For not tokenizable regexes it may be good idea to compile only one regular expression.

/^(?:http|ws)s?://\[f(?:[cd][0-9a-f]|e[c-f])[0-9a-f]:[0-9a-f:]+\][:/]/$third-party

https://regex101.com/r/O0tAKl/2

@gwarser gwarser changed the title Add ipv6 local netwok filters Add ipv6 local network filters Jul 7, 2020
@gwarser gwarser closed this as completed in ee2e167 Jul 7, 2020
gwarser added a commit to uBlockOrigin/uAssets that referenced this issue Nov 18, 2021
gwarser added a commit to uBlockOrigin/uAssets that referenced this issue Nov 18, 2021
gwarser added a commit to uBlockOrigin/uAssets that referenced this issue Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants