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

only determine client IP from trusted headers #513

Merged
merged 9 commits into from
Aug 31, 2023

Conversation

florianbrinkmann
Copy link
Member

Code change and description by @stklcode

By default, we only look for the client's IP address in the REMOTE_ADDR header. This can be extended via hook if there is a need to use headers like X-Forwarded-For ("HTTP_X_FORWARDED_FOR") instead.

Headers will be processed in the provided order and return the first valid IP address found.

By default, we only look for the client's IP address in the REMOTE_ADDR
header. This can be extended via hook if there is a need to use headers
like X-Forwarded-For ("HTTP_X_FORWARDED_FOR") instead.

Headers will be processed in the provided order and return the first
valid IP address found.
@Zodiac1978
Copy link
Member

Maybe this filter is not necessary, as there is one in WP core since 1.5:
https://developer.wordpress.org/reference/hooks/pre_comment_user_ip/

@Zodiac1978 Zodiac1978 added this to the 2.12.0 milestone Aug 20, 2023
@sonarcloud
Copy link

sonarcloud bot commented Aug 31, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@Zodiac1978 Zodiac1978 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@florianbrinkmann florianbrinkmann merged commit 42b71ba into master Aug 31, 2023
41 checks passed
@florianbrinkmann florianbrinkmann deleted the improve-ip-check-2 branch August 31, 2023 21:01
@Zodiac1978 Zodiac1978 removed this from the 2.12.0 milestone Mar 10, 2024
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.

4 participants