Repository navigation
IBX-11181: Fixed setting Trusted Proxies on Ibexa Cloud - #699
Conversation
38c87b6 to
17e4096
Compare
17e4096 to
b1a199d
Compare
|
ec3cba0 to
d53633c
Compare
|
konradoboza
left a comment
There was a problem hiding this comment.
PR can be rebased as #794 got merged, it contains PHPStan issues fix.
A few questions:
PR for filtering X-Forward-For in varnish and fastly VCLs are comming
Do we have this PR already? It should most likely incorporate X-Forward-For and X-Forward-Host in our VCL, right?
Shouldn't this indeed belong to ibexa/fastly since it's covering this very case? It will also make more sense concerning merging up the changes.
In regards to:
As the Upsun router anyway sets the X-Forward-For header, and devs still needed to set trusted_proxies in config ( which IMO is impossible), the old implementation in TrustedHeaderClientIpEventSubscriber is void.
But it certainly may be that I am missing something important....?
https://github.com/ibexa/post-install/blob/4.6/resources/platformsh/ibexa-commerce/4.6/.platform.app.yaml#L65 I think this is where it can be omitted once projects are created from templates. This seems like potential security flaw where XFF remains untouched. The subscriber in question overwrites XFF (attacker-influenced?) with X-Client-IP (router-controlled) so that the processing reads a clean value.
It seems we need to do the following to summarize:
- sunset
ibexa/fastly-forwarded-host(archive), - make sure VCL is properly updated,
- the combo mentioned below is verified not to fallback to the Symfony defaults.
|
@vidarl just making sure we are not stuck: is this topic still in progress concerning this comment or do you wait for our input? |
@konradoboza |
|
Makes sense, thank you for the heads up! |
e026319 to
609d925
Compare
|
So, varnish9 has now landed upstream, and I have fixed all related PR accordingly and rebased on top of 4.6 tip. ( Most changes where in http-cache) |
24bfa57 to
ddc864e
Compare
…egistered it as a service
…egistered it as a service
…egistered it as a service
c871a50 to
4997bc4
Compare
4997bc4 to
116cd9d
Compare
|
…egistered it as a service



Caution
When merging up to 5.0, remove
TrustedHeaderClientIpEventSubscriberfrom core rather than resolving the conflicts in it. On 5.x the Ibexa Cloud logic lives in ibexa/cloud (ibexa/cloud#13).Remove:
src/bundle/Core/EventSubscriber/TrustedHeaderClientIpEventSubscriber.phptests/bundle/Core/EventSubscriber/TrustedHeaderClientIpEventSubscriberTest.phpsrc/bundle/Core/Resources/config/services.ymlphpstan-baseline.neonentries for both filesRelated PRs:
ibexa.trusted_header_client_ip_namefrom experience and commerce recipes recipes-dev#274Description:
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:
ibexa.trusted_header_client_ip_namesetting that was available but commented out by default inconfig/packages/ibexa.yaml. It was not referred to anywhere else AFAIK, and I don't think anyone ever used that setting. so not sure it needs mentioning anywhereX-FORWARDED-....) on Ibexa Cloud when using Fastly; This will now actually causeX-FORWARDED-HOSTto be trusted and have an affect: