Skip to content

IBX-11181: Filtered client-supplied X-Forwarded-* headers in Varnish VCL - #87

Merged
alongosz merged 12 commits into
4.6from
IBX-11181-Trusted_Proxies_is_not_set_on_Ibexa_Cloud
Oct 28, 2026
Merged

alongosz merged 12 commits into
4.6from
IBX-11181-Trusted_Proxies_is_not_set_on_Ibexa_Cloud

Conversation

@vidarl

@vidarl vidarl commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor
🎫 Issue IBX-11181

Note

SonarCloud error is false positive. behat tests refers to github actions by ibexa repo/branchname instead of SHA commit hash

Related PRs:

ibexa/docker#65 must be merged before this one ( once it is merged, the [TMP] commit in this PR can be removed )

Description:

Follow-up to ibexa/core#699, which makes Ibexa DXP declare the peer a trusted proxy when a request
arrives via Fastly on Ibexa Cloud. Once trusted proxies are in play, every X-Forwarded-* header a
client sends is believed by Symfony, so Varnish has to stop them from reaching the application.

Until now the VCLs took X-Forwarded-Proto straight from the client and derived X-Forwarded-Port
from it, and never touched Forwarded, X-Forwarded-Host or X-Forwarded-Prefix. A client could
therefore spoof the scheme and host the application sees. Since X-Forwarded-* is not part of the
Varnish cache key, a spoofed value also poisons the cached object for everyone else.

vcl_recv now strips those headers for every client that is not listed in a new trusted_proxies
ACL in parameters.vcl, and overwrites X-Forwarded-For with the real client IP. X-Client-IP and
Client-Cdn are stripped too, so a client cannot fake the Ibexa Cloud detection added in
ibexa/core#699. A proxy that is in the ACL keeps passing everything through, which is what a TLS
terminator, load balancer or CDN in front of Varnish relies on.

Applies to varnish5.vcl, varnish6.vcl and varnish7.vcl. varnish9.vcl is deliberately left
out while its own PRs are open; it gets the same treatment once they land.

SonarCloud complains: Use full commit SHA hash for this dependency.. However, I refer to main branch in a ibexa repository. This is considered safe and that warning can be ignored.

BC breaks:

varnish5/6/7.vcl now reference the trusted_proxies ACL, which lives in parameters.vcl. Varnish
resolves ACLs at VCL load time, so parameters.vcl and the VCL must be updated together - an
existing parameters.vcl without the ACL makes Varnish fail to load with
Symbol not found: 'trusted_proxies'. There is no way to make an ACL reference optional in VCL.

The ACL ships with localhost only. Anyone running a TLS terminator in front of Varnish has to add
its IP, otherwise the X-Forwarded-Proto it sets is discarded and URLs are generated as http://.
Documented in docs/varnish/README.md.

For QA:

Check that https URL generation still works behind a TLS terminator once its IP is added to the
trusted_proxies ACL, and that cache invalidation and the X-Cache debug headers are unaffected.
Easiest done using a custom controller that outputs those headers if they exists, maybe

@vidarl
vidarl force-pushed the IBX-11181-Trusted_Proxies_is_not_set_on_Ibexa_Cloud branch 2 times, most recently from 434e83e to 15d27f9 Compare August 19, 2026 07:15
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@konradoboza konradoboza left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The VCL and reasoning looks good enough, I like the extended testing setup. Summoning @alongosz for his opinion on the bash/CI changes and @ibexa/quality-assurance in regards to docker/Behat. 😉

Comment thread .github/workflows/backend-ci.yaml Resolved
Comment thread .github/workflows/backend-ci.yaml Resolved
Comment thread .github/workflows/browser-tests.yaml Resolved
@konradoboza konradoboza added the Doc needed The changes require some documentation label Sep 11, 2026
@konradoboza
konradoboza requested a review from a team September 11, 2026 07:08
@ibexa-workflow-automation-1
ibexa-workflow-automation-1 Bot requested review from micszo and pawlakadrian and removed request for a team and tbialcz September 11, 2026 07:09
Comment thread .github/workflows/backend-ci.yaml Resolved
Comment thread .github/workflows/browser-tests.yaml Resolved
@vidarl
vidarl force-pushed the IBX-11181-Trusted_Proxies_is_not_set_on_Ibexa_Cloud branch from 03221b4 to 16cc588 Compare October 28, 2026 14:18
@vidarl
vidarl force-pushed the IBX-11181-Trusted_Proxies_is_not_set_on_Ibexa_Cloud branch from 16cc588 to 02ff4d3 Compare October 28, 2026 14:33
@sonarqubecloud

Copy link
Copy Markdown

@alongosz
alongosz merged commit ae33581 into 4.6 Oct 28, 2026
65 of 66 checks passed
@alongosz
alongosz deleted the IBX-11181-Trusted_Proxies_is_not_set_on_Ibexa_Cloud branch October 28, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Doc needed The changes require some documentation QA approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants