-
Notifications
You must be signed in to change notification settings - Fork 9
COMP-1149 added HttpClientAddressResolver in RateLimiterFilter #966
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: munishchouhan <hrma017@gmail.com>
Signed-off-by: munishchouhan <hrma017@gmail.com>
Signed-off-by: munishchouhan <hrma017@gmail.com>
|
|
||
| @Inject | ||
| @Nullable | ||
| private HttpClientAddressResolver addressResolver |
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.
What's prevent to use this always ?
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.
I am concerned that, it will add performance overhead on each request, I will dig more to see what is better
Signed-off-by: munishchouhan <hrma017@gmail.com>
Signed-off-by: munishchouhan <hrma017@gmail.com>
Signed-off-by: munishchouhan <hrma017@gmail.com>
Signed-off-by: munishchouhan <hrma017@gmail.com>
Signed-off-by: munishchouhan <hrma017@gmail.com>
Signed-off-by: munishchouhan <hrma017@gmail.com>
|
tested in dev: |
|
run again: |
Signed-off-by: munishchouhan <hrma017@gmail.com>
|
if removed alb env: |
Summary
Fixed IP address spoofing vulnerability where attackers could bypass rate limiting by sending arbitrary
X-Forwarded-Forheaders. The rate limiter now uses socket addresses by default (secure) with opt-in support for trusted proxy headers when deployed behind AWS ALB.Vulnerability
The rate limiter previously trusted client-supplied
X-Forwarded-Forheaders without validation, allowing attackers to bypass rate limits by spoofing different IP addresses:Solution
Implemented custom
SecureHttpClientAddressResolverthat takes the rightmost IP from comma-separatedX-Forwarded-Forheaders:X-Forwarded-For(the one ALB added)Key Implementation
Why Rightmost IP?
When behind ALB, the X-Forwarded-For header contains:
Example:
Changes
Core Files
SecureHttpClientAddressResolver.groovy (NEW) (
src/main/groovy/io/seqera/wave/util/SecureHttpClientAddressResolver.groovy):ContainerController.groovy & RegistryProxyController.groovy:
HttpClientAddressResolverRateLimiterFilter.groovy (
src/main/groovy/io/seqera/wave/filter/RateLimiterFilter.groovy):HttpClientAddressResolverConfiguration
src/main/resources/application-alb.yml):client-address-header: X-Forwarded-ForTests
src/test/groovy/io/seqera/wave/filter/RateLimiterFilterTest.groovy):Documentation
Security Benefits
Default Mode (Secure by Default)
ALB Mode (When Configured)