-
Notifications
You must be signed in to change notification settings - Fork 392
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
feat:support configuring xff trusted cidrs #4702
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4702 +/- ##
==========================================
- Coverage 66.71% 66.71% -0.01%
==========================================
Files 211 211
Lines 32811 32846 +35
==========================================
+ Hits 21891 21913 +22
- Misses 9591 9600 +9
- Partials 1329 1333 +4 ☔ View full report in Codecov by Sentry. |
3ba436b
to
25f96f1
Compare
hey @rudrakhp can we add an e2e for this in this PR, or can you confirm this works by testing manually (and e2e can be added in a follow up) |
c145161
to
52831e6
Compare
@arkodg I tried to use original IP detection extension's |
1fde45a
to
5595e7d
Compare
@rudrakhp This is probably related to envoyproxy/envoy#34241 |
5154988
to
5c96805
Compare
To move this PR ahead, We probably could modify the existing RBAC e2e.
But I'm not sure which behavior is correct, the HCM xff_num_trusted_hops or the xff extension. |
Raised a PR envoyproxy/envoy#37780 to seek help from the Enovy maintainers. |
Not sure if that's the right thing to do, isn't it essentially changing behaviour for EGW users, probably breaking? |
07db398
to
4ae4ecf
Compare
4ae4ecf
to
73f5b21
Compare
internal/xds/translator/listener.go
Outdated
if clientIPDetection.XForwardedFor.TrustedCIDRs != nil { | ||
trustedCidrs := make([]*corev3.CidrRange, 0) | ||
for _, cidr := range clientIPDetection.XForwardedFor.TrustedCIDRs { | ||
parsedCidr := strings.Split(string(cidr), "/") |
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.
can we use net.ParseCIDR
here to derive prefix and mask ?
rds: | ||
configSource: | ||
ads: {} | ||
resourceApiVersion: V3 | ||
routeConfigName: first-listener | ||
serverHeaderTransformation: PASS_THROUGH | ||
statPrefix: http-8081 | ||
useRemoteAddress: true | ||
xffNumTrustedHops: 2 | ||
useRemoteAddress: false |
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.
since skipXffAppend: false
exists, we will maintain backwards compatibility where the gateway ip will be appended to the off ?
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.
Yes, when use_remote_address: true
was used earlier, HCM's skip_xff_append
was used, which defaults to false
(see this).
When moving to to the extension and setting use_remote_address: false
, we will have to set the extension's skip_xff_append
to false
explicitly since it defaults to true
(see this).
Signed-off-by: Rudrakh Panigrahi <rudrakh97@gmail.com>
73f5b21
to
d0301e0
Compare
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.
LGTM. Thank you for your patience and for adding this valuable feature!
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.
LGTM thanks !
the ipv6 address was not defined in the authorization section Test failure: https://github.com/envoyproxy/gateway/actions/runs/12772899958/job/35604351424 Relates to envoyproxy#4702 Signed-off-by: Arko Dasgupta <arko@tetrate.io>
the ipv6 address was not defined in the authorization section Test failure: https://github.com/envoyproxy/gateway/actions/runs/12772899958/job/35604351424 Relates to envoyproxy#4702 Signed-off-by: Arko Dasgupta <arko@tetrate.io>
What type of PR is this?
feat:support configuring xff trusted cidrs
What this PR does / why we need it:
Implement API introduced in #4500
Which issue(s) this PR fixes:
Refer #4489
Release Notes: No