-
Notifications
You must be signed in to change notification settings - Fork 35
feat: allow to pass list of headers to getIp #196
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
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe pull request introduces IP validation to the Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/Request.php(2 hunks)
🔇 Additional comments (1)
src/Request.php (1)
180-195: IP extraction and validation logic is correct.The implementation correctly:
- Iterates through trusted headers
- Extracts the leftmost IP from comma-separated proxy chains (the originating client IP)
- Validates IP format for both IPv4 and IPv6 using
filter_var- Returns the first valid IP found
This logic is sound, but its security depends entirely on only trusting headers when requests actually come from trusted proxies (see earlier comment on lines 56-61).
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.