in2code-de / ipandlanguageredirect

TYPO3 redirect - browserlanguage and ip-address based
GNU General Public License v3.0
14 stars 14 forks source link

IP address regexp is not good enough #39

Closed dmitryd closed 1 year ago

dmitryd commented 1 year ago

The security fix in 5.1.2 introduced a regexp to "fix" ip addresses. However it will corrupt IPv6 addresses:

 $ php -a
Interactive shell

php > echo preg_replace('~[^0-9\.]~', '', '2001:0db8:85a3:0000:0000:8a2e:0370:7334');
200108853000000008203707334

At least there should be a colon added to the regexp.

dmitryd commented 1 year ago

Another issue that IPv6 is not supported at all here because of inet_aton is IPv4 only :(

einpraegsam commented 1 year ago

Thx for your issue. We know that the regex is optimized for IPv4 only. That's because at the moment there are only IPv4 addresses stored in the related table tx_ipandlanguageredirect_domain_model_iptocountry So, it is a missing feature to also provide a "IPv6 to Country mapping table" at the moment.