IBX-11181: Trusted Proxies is not set on Ibexa Cloud - #699
Conversation
38c87b6 to
17e4096
Compare
| @@ -15,16 +15,6 @@ | |||
|
|
|||
| final class TrustedHeaderClientIpEventSubscriber implements EventSubscriberInterface | |||
There was a problem hiding this comment.
| final class TrustedHeaderClientIpEventSubscriber implements EventSubscriberInterface | |
| final class IbexaCloudTrustedProxiesEventSubscriber implements EventSubscriberInterface |
Or this is considered a BC ? Class is final though, so maybe not a problem?
17e4096 to
b1a199d
Compare
|
ec3cba0 to
d53633c
Compare
| $trustedHeaderName = $this->trustedHeaderName; | ||
| if (null === $trustedHeaderName && $this->isPlatformShProxy($request)) { | ||
| $trustedHeaderName = self::PLATFORM_SH_TRUSTED_HEADER_CLIENT_IP; | ||
| if ($this->isPlatformShProxy($request) && $request->headers->get('Client-Cdn') === 'fastly') { |
There was a problem hiding this comment.
As discussed with Vidar Client-Cdn header is stripped by Upsun when request is not coming from trusted CDN (in case we care about security and we do)
There was a problem hiding this comment.
Confirmed by Upsun (thanks Vidar for reaching out to them with this question): client can't spoof Client-Cdn header - it should arrive into their docs soon so we know for sure we can trust this header.
|



Related PRs:
Description:
Trusted proxies are not set on Ibexa Cloud when using Fastly. We document (via Upsun,) that user must disable
TRUSTED_PROXIES: "REMOTE_ADDR"in.platform.app.yaml(which is correct), but we don’t say or specify how to configureTRUSTED_PROXIEScorrectly.And frankly, it is not easy/possible to do via static config given how the Upsun router behaves:
Upsun router behavior:
X-FORWARD-FORsent by malicious clientX-FORWARD-FOR, appending header if already set ( "1.1.1.1" => "1.1.1.1, 2.2.2.2")X-Client-IPheader ( value is IP of client). Value is also end-user's IP if request is received via Fastly ( doc )fastlySo there is no static IP or IP range you can set as trusted proxies when using Fastly on Upsun. For instance, setting trusted hosts to Fasty's public IP list will not do any good. Thus, Ibexa DXP should automatically detect on Ibexa Cloud if request is received via Fastly
Next, I really doesn't understand the original purpose of
TrustedHeaderClientIpEventSubscriber. It basically does this:X_FORWARDED_FORwill be set (value will be copied from theX-Client-IPrequest header) andX_FORWARDED_FORwill be set astrusted_headerstrusted_proxiescorrectly.X-Client-IPas sourceMy next doubt is why there was some need for this in relation to IBX-4046
FYI : Original PR : https://github.com/ibexa/core/pull/165/files
As the Upsun router anyway sets the X-Forward-For header, and devs still needed to set
trusted_proxiesin config ( which IMO is impossible), the old implementation inTrustedHeaderClientIpEventSubscriberis void.But it certainly may be that I am missing something important....?
What the new implementation of
TrustedHeaderClientIpEventSubscriberdoes:For QA:
Maybe do sanity checks with "create Applications for Customer portal" feature, as original implementation of
TrustedHeaderClientIpEventSubscriberwas implemented in relation to that.Documentation: