-
Notifications
You must be signed in to change notification settings - Fork 557
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
fix: ClientIP handling is unsafe #401
Conversation
Codecov ReportBase: 69.42% // Head: 69.95% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## develop #401 +/- ##
===========================================
+ Coverage 69.42% 69.95% +0.52%
===========================================
Files 93 93
Lines 8874 8907 +33
===========================================
+ Hits 6161 6231 +70
+ Misses 2348 2304 -44
- Partials 365 372 +7
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Please resign the CLA🙏 |
got it. |
daed362
to
bd9c6cb
Compare
bd9c6cb
to
0ce4ed0
Compare
any process? @BaiZe1998 |
0ce4ed0
to
84e2f56
Compare
LGTM |
What type of PR is this?
fix
Check the PR title.
(Optional) Translate the PR title into Chinese.
修复使用 ClientIP() 获取客户端 IP 时存在的安全问题
(Optional) More detail description for this PR(en: English/zh: Chinese).
en:
Problems.
Solution.
Referring to gin's fix idea, add TrustedProxies list to store a list of trusted proxy server addresses for the server, by default "0.0.0.0", the logic within the ClientIP method is as follows.
zh(optional):
问题:
解决方案:
参考了 gin 的修复思路,增加 TrustedProxies 列表存放服务器可信的代理服务器地址列表,默认情况下为 "0.0.0.0",ClientIP 方法内逻辑如下:
Which issue(s) this PR fixes:
Fixes #161