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

Allow using hashed IP addresses #9

Merged
merged 5 commits into from
Dec 8, 2021
Merged

Conversation

AndreasMaros
Copy link
Contributor

This PR introduces the option of hashing IP addresses before storing them. Similar to #7 this avoids problems when using a filesystem-based cache implementation, but also covers IPv6 addresses (as opposed to the IPv4-only covered by #7). The library's base functionality remains unchanged; the new feature is implemented via an opt-in configuration setting.

Using hashing instead of a regex-replacement has the added benefit of anonymizing user's addresses inside the cache and thus being compliant with data privacy norms.

The salted MD5 hashing algorithm used is a compromise between relative security of these user data and speed in order not to become a bottleneck.

I've added tests for both the default behaviour and the new behaviour with IP hashing enabled. In doing so, I've refactored the tests a little and fixed the PSR-4 root declaration for the test namespace.

@Lansoweb
Copy link
Owner

Lansoweb commented Dec 8, 2021

Thanks a lot!

@Lansoweb Lansoweb merged commit 7596d9e into Lansoweb:master Dec 8, 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

Successfully merging this pull request may close these issues.

2 participants