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

[BUG] AnonymizeIP not anonymizing by octets #3262

Closed
dev-rke opened this issue Jun 1, 2022 · 0 comments · Fixed by #3354
Closed

[BUG] AnonymizeIP not anonymizing by octets #3262

dev-rke opened this issue Jun 1, 2022 · 0 comments · Fixed by #3354

Comments

@dev-rke
Copy link
Contributor

dev-rke commented Jun 1, 2022

Describe the bug
AnonymizeIP won't anonymize by octets for IPv4.

To Reproduce
Copy applyIpV4Mask method into an interactive PHP shell and run these commands:

php > echo applyIpV4Mask("192.168.123.5", 2) . PHP_EOL;
192.168.123
php > echo applyIpV4Mask("192.168.123.15", 2) . PHP_EOL;
192.168.123.
php > echo applyIpV4Mask("192.168.123.15", 4) . PHP_EOL;
192.168.12
php > echo applyIpV4Mask("192.168.123.15", 3) . PHP_EOL;
192.168.123
php > echo applyIpV4Mask("192.168.123.153", 3) . PHP_EOL;
192.168.123.
php > echo applyIpV4Mask("192.168.123.153", 1) . PHP_EOL;
192.168.123.15
php > echo applyIpV4Mask("192.168.123.15", 1) . PHP_EOL;
192.168.123.1
php > echo applyIpV4Mask("192.168.123.1", 1) . PHP_EOL;
192.168.123.

Expected behavior
I'd expect the last octet is set to 0.
Example:
User has the ip 192.168.123.234. In the log it should be 192.168.123.0

Used versions (please complete the following information):

  • TYPO3 Version: 10 and 11
  • EXT:solr Version: tested with 11.0 and 11.5-rc2

Recommendation
I'd recommend to use the IpAnonymizationUtility::anonymizeIp() function of the TYPO3 core to achieve the correct behaviour.
This class is available since TYPO3 v9.2, so it should be available in all current supported TYPO3 versions:
https://github.com/TYPO3/typo3/blob/9.5/typo3/sysext/core/Classes/Utility/IpAnonymizationUtility.php

By the way: thanks for the great extension - i just used 11.5-rc2 with the awesome API in a project.

dkd-kaehm added a commit that referenced this issue Oct 4, 2022
dkd-kaehm added a commit that referenced this issue Oct 4, 2022
dkd-kaehm added a commit that referenced this issue Oct 4, 2022
dkd-kaehm added a commit to dkd-kaehm/ext-solr that referenced this issue Oct 4, 2022
dkd-kaehm added a commit to dkd-kaehm/ext-solr that referenced this issue Oct 4, 2022
dkd-kaehm added a commit that referenced this issue Oct 4, 2022
dkd-friedrich added a commit to dkd-friedrich/ext-solr that referenced this issue Nov 2, 2022
This is a maintaine release for TYPO3 10.4, containing:

- [BUGFIX] Prepend wrong fe language on empty cache (TYPO3-Solr#3375)
- [TASK] Use TYPO3 IpAnonymizationUtility (TYPO3-Solr#3262)
- [BUGFIX:BP:11.2] Shortcircuit work in SolrRoutingMiddleware (TYPO3-Solr#3202)
- [TASK] Fix scrutinizer on release-11.2.x
- [BUGFIX:BP:11.2] Do not handle page updates on new page with uid 0
(TYPO3-Solr#3338)
- [TASK] Remove not used strptime() adaption for windows.
- [BUGFIX] Respect indexing configuration for new and updated subpages
(TYPO3-Solr#3276)
- [BUGFIX] Ensure keywords string does not exceed database field length
(TYPO3-Solr#3321)
- [TASK:BP:11.2] Adapt column arrangement within sites config (TYPO3-Solr#3295)
- [DOCS:BP:11.2] add missing doc for ..pageIndexed (#)
- [BUGFIX] Fix PSR-4 Namespaces and Paths (TYPO3-Solr#3285)
- [BUGFIX] Silence DebugWriter for PageIndexerRequest (TYPO3-Solr#3030)
- [BUGFIX] AbstractSolrTask::setRootPageId(): Argument TYPO3-Solr#1 () must be
of type int, string given (TYPO3-Solr#3267)
- [BUGFIX:11.2] Update GarbageCollector.php (TYPO3-Solr#3249)
- [DOCS] Align with new TYPO3 documentation standards (TYPO3-Solr#3242)
- [DOCS] Align README.md with other extensions (TYPO3-Solr#3218)
- [BUGFIX] Missing dot in configuration in numberOfResultsPerGroup
method (TYPO3-Solr#3098
- [TASK] Added info about using page content in fields
- [TASK] Added info about the virtual field __solr_contents
- [BUGFIX:BP:11.2] Fix write connection (TYPO3-Solr#2916)

Please read the release notes:
https://github.com/TYPO3-Solr/ext-solr/releases/tag/11.1.3

---

How to Get Involved

There are many ways to get involved with Apache Solr for TYPO3:

Submit bug reports and feature requests on GitHub
Ask or help or answer questions in our Slack channel
Provide patches through Pull Request or review and comment on existing
Pull Requests
Go to www.typo3-solr.com or call dkd to sponsor the ongoing development
of Apache Solr for TYPO3

Support us by becoming an EB partner:
https://shop.dkd.de/Produkte/Apache-Solr-fuer-TYPO3/

or call:
+49 (0)69 - 2475218 0
dkd-friedrich added a commit to dkd-friedrich/ext-solr that referenced this issue Nov 2, 2022
This is a maintenance release for TYPO3 10.4, containing:

- [BUGFIX] Prepend wrong fe language on empty cache (TYPO3-Solr#3375)
- [TASK] Use TYPO3 IpAnonymizationUtility (TYPO3-Solr#3262)
- [BUGFIX:BP:11.2] Shortcircuit work in SolrRoutingMiddleware (TYPO3-Solr#3202)
- [TASK] Fix scrutinizer on release-11.2.x
- [BUGFIX:BP:11.2] Do not handle page updates on new page with uid 0
(TYPO3-Solr#3338)
- [TASK] Remove not used strptime() adaption for windows.
- [BUGFIX] Respect indexing configuration for new and updated subpages
(TYPO3-Solr#3276)
- [BUGFIX] Ensure keywords string does not exceed database field length
(TYPO3-Solr#3321)
- [TASK:BP:11.2] Adapt column arrangement within sites config (TYPO3-Solr#3295)
- [DOCS:BP:11.2] add missing doc for ..pageIndexed (#)
- [BUGFIX] Fix PSR-4 Namespaces and Paths (TYPO3-Solr#3285)
- [BUGFIX] Silence DebugWriter for PageIndexerRequest (TYPO3-Solr#3030)
- [BUGFIX] AbstractSolrTask::setRootPageId(): Argument TYPO3-Solr#1 () must be
of type int, string given (TYPO3-Solr#3267)
- [BUGFIX:11.2] Update GarbageCollector.php (TYPO3-Solr#3249)
- [DOCS] Align with new TYPO3 documentation standards (TYPO3-Solr#3242)
- [DOCS] Align README.md with other extensions (TYPO3-Solr#3218)
- [BUGFIX] Missing dot in configuration in numberOfResultsPerGroup
method (TYPO3-Solr#3098
- [TASK] Added info about using page content in fields
- [TASK] Added info about the virtual field __solr_contents
- [BUGFIX:BP:11.2] Fix write connection (TYPO3-Solr#2916)

Please read the release notes:
https://github.com/TYPO3-Solr/ext-solr/releases/tag/11.2.1

---

How to Get Involved

There are many ways to get involved with Apache Solr for TYPO3:

Submit bug reports and feature requests on GitHub
Ask or help or answer questions in our Slack channel
Provide patches through Pull Request or review and comment on existing
Pull Requests
Go to www.typo3-solr.com or call dkd to sponsor the ongoing development
of Apache Solr for TYPO3

Support us by becoming an EB partner:
https://shop.dkd.de/Produkte/Apache-Solr-fuer-TYPO3/

or call:
+49 (0)69 - 2475218 0
dkd-friedrich added a commit to dkd-friedrich/ext-solr that referenced this issue Nov 2, 2022
This is a maintenance release for TYPO3 10.4, containing:

- [BUGFIX] Prepend wrong fe language on empty cache (TYPO3-Solr#3375)
- [TASK] Use TYPO3 IpAnonymizationUtility (TYPO3-Solr#3262)
- [BUGFIX:BP:11.2] Shortcircuit work in SolrRoutingMiddleware (TYPO3-Solr#3202)
- [TASK] Fix scrutinizer on release-11.2.x
- [BUGFIX:BP:11.2] Do not handle page updates on new page with uid 0
(TYPO3-Solr#3338)
- [TASK] Remove not used strptime() adaption for windows.
- [BUGFIX] Respect indexing configuration for new and updated subpages
(TYPO3-Solr#3276)
- [BUGFIX] Ensure keywords string does not exceed database field length
(TYPO3-Solr#3321)
- [TASK:BP:11.2] Adapt column arrangement within sites config (TYPO3-Solr#3295)
- [DOCS:BP:11.2] add missing doc for ..pageIndexed
- [BUGFIX] Fix PSR-4 Namespaces and Paths (TYPO3-Solr#3285)
- [BUGFIX] Silence DebugWriter for PageIndexerRequest (TYPO3-Solr#3030)
- [BUGFIX] AbstractSolrTask::setRootPageId(): Argument TYPO3-Solr#1 must be
of type int, string given (TYPO3-Solr#3267)
- [BUGFIX:11.2] Update GarbageCollector.php (TYPO3-Solr#3249)
- [DOCS] Align with new TYPO3 documentation standards (TYPO3-Solr#3242)
- [DOCS] Align README.md with other extensions (TYPO3-Solr#3218)
- [BUGFIX] Missing dot in configuration in numberOfResultsPerGroup
method (TYPO3-Solr#3098
- [TASK] Added info about using page content in fields
- [TASK] Added info about the virtual field __solr_contents
- [BUGFIX:BP:11.2] Fix write connection (TYPO3-Solr#2916)

Please read the release notes:
https://github.com/TYPO3-Solr/ext-solr/releases/tag/11.2.1

---

How to Get Involved

There are many ways to get involved with Apache Solr for TYPO3:

Submit bug reports and feature requests on GitHub
Ask or help or answer questions in our Slack channel
Provide patches through Pull Request or review and comment on existing
Pull Requests
Go to www.typo3-solr.com or call dkd to sponsor the ongoing development
of Apache Solr for TYPO3

Support us by becoming an EB partner:
https://shop.dkd.de/Produkte/Apache-Solr-fuer-TYPO3/

or call:
+49 (0)69 - 2475218 0
dkd-friedrich added a commit that referenced this issue Nov 2, 2022
This is a maintenance release for TYPO3 10.4, containing:

- [BUGFIX] Prepend wrong fe language on empty cache (#3375)
- [TASK] Use TYPO3 IpAnonymizationUtility (#3262)
- [BUGFIX:BP:11.2] Shortcircuit work in SolrRoutingMiddleware (#3202)
- [TASK] Fix scrutinizer on release-11.2.x
- [BUGFIX:BP:11.2] Do not handle page updates on new page with uid 0
(#3338)
- [TASK] Remove not used strptime() adaption for windows.
- [BUGFIX] Respect indexing configuration for new and updated subpages
(#3276)
- [BUGFIX] Ensure keywords string does not exceed database field length
(#3321)
- [TASK:BP:11.2] Adapt column arrangement within sites config (#3295)
- [DOCS:BP:11.2] add missing doc for ..pageIndexed
- [BUGFIX] Fix PSR-4 Namespaces and Paths (#3285)
- [BUGFIX] Silence DebugWriter for PageIndexerRequest (#3030)
- [BUGFIX] AbstractSolrTask::setRootPageId(): Argument #1 must be
of type int, string given (#3267)
- [BUGFIX:11.2] Update GarbageCollector.php (#3249)
- [DOCS] Align with new TYPO3 documentation standards (#3242)
- [DOCS] Align README.md with other extensions (#3218)
- [BUGFIX] Missing dot in configuration in numberOfResultsPerGroup
method (#3098
- [TASK] Added info about using page content in fields
- [TASK] Added info about the virtual field __solr_contents
- [BUGFIX:BP:11.2] Fix write connection (#2916)

Please read the release notes:
https://github.com/TYPO3-Solr/ext-solr/releases/tag/11.2.1

---

How to Get Involved

There are many ways to get involved with Apache Solr for TYPO3:

Submit bug reports and feature requests on GitHub
Ask or help or answer questions in our Slack channel
Provide patches through Pull Request or review and comment on existing
Pull Requests
Go to www.typo3-solr.com or call dkd to sponsor the ongoing development
of Apache Solr for TYPO3

Support us by becoming an EB partner:
https://shop.dkd.de/Produkte/Apache-Solr-fuer-TYPO3/

or call:
+49 (0)69 - 2475218 0
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

Successfully merging a pull request may close this issue.

1 participant