-
Notifications
You must be signed in to change notification settings - Fork 67
fix: Secure x-forwarded-* headers from untrusted proxies but trust all apiml proxies (v2) #4188
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
Signed-off-by: Pavel Jareš <[email protected]>
Signed-off-by: Richard Salac <[email protected]>
Signed-off-by: Richard Salac <[email protected]>
Signed-off-by: Richard Salac <[email protected]>
Signed-off-by: Richard Salac <[email protected]>
Signed-off-by: Richard Salac <[email protected]>
35a21ce
to
25754b4
Compare
Signed-off-by: Richard Salac <[email protected]>
b4341a2
to
792751d
Compare
...lity/src/main/java/org/zowe/apiml/product/gateway/AdditionalRegistrationGatewayRegistry.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/zowe/apiml/cloudgatewayservice/filters/X509awareXForwardedHeadersFilter.java
Outdated
Show resolved
Hide resolved
@Value("${test.proxyAddress}") | ||
public String proxyAddress; | ||
public AtomicReference<String> proxyAddressReference; | ||
private String originalProxyAddressProperty; |
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.
Could it be final
?
private String originalProxyAddressProperty; | |
private final String originalProxyAddressProperty; |
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.
done
gateway-service/src/main/java/org/zowe/apiml/gateway/config/DiscoveryClientConfig.java
Outdated
Show resolved
Hide resolved
gateway-service/src/test/java/org/zowe/apiml/acceptance/ForwardedHeadersProxyTest.java
Outdated
Show resolved
Hide resolved
af55fdf
to
9479cbe
Compare
28e92fd
to
8a9c225
Compare
8a9c225
to
16010f2
Compare
c52ab9a
to
05945b9
Compare
Signed-off-by: Richard Salac <[email protected]>
05945b9
to
2b052c4
Compare
Signed-off-by: Richard Salac <[email protected]>
d371b5a
to
c280c02
Compare
Signed-off-by: Richard Salac <[email protected]>
integration-tests/src/test/java/org/zowe/apiml/integration/proxy/XForwardHeadersProxyTest.java
Show resolved
Hide resolved
integration-tests/src/test/java/org/zowe/apiml/integration/proxy/XForwardHeadersProxyTest.java
Outdated
Show resolved
Hide resolved
integration-tests/src/test/java/org/zowe/apiml/integration/proxy/XForwardHeadersProxyTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Richard Salac <[email protected]>
8dae36a
to
c0799b1
Compare
Signed-off-by: Richard Salac <[email protected]>
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!
09f4f6a
to
dba7ae3
Compare
|
Description
This is a follow-up to issue #4148. In that issue, a new configuration option was added to define a pattern for validating whether requests with x-forwarded-* headers originate from trusted proxy servers. These headers are only processed if the source is deemed trustworthy and the headers are considered safe.
While this security issue was addressed, the new configuration option must now also be set for APIML gateways to ensure that x-forwarded-* headers are trusted. This configuration is only necessary in scenarios where requests traverse multiple gateways — a common pattern in hybrid deployments such as multi-sysplex environments or setups involving both z/OS and Kubernetes. In such cases, multiple APIML domain installations are interconnected through central gateways. Although such deployments are relatively rare, they are typically more complex — and we want to avoid introducing additional complexity.
To support this, APIML domains can be onboarded to the central gateway through additional gw registrations (and vice versa). We utilize these registrations to fetch APIML gateways information from remote discovery services. Based on this data, we dynamically update the list of trusted proxies so that APIML proxies are consistently treated as trusted.
Non-APIML gateways still must be configured to be trusted.
Linked to # (4148)
Part of the # (epic)
Type of change
Please delete options that are not relevant.
Checklist:
For more details about how should the code look like read the Contributing guideline