fix(pagecache): pass authenticated non-GraphQL requests in Varnish VCL#40677
fix(pagecache): pass authenticated non-GraphQL requests in Varnish VCL#40677lbajsarowicz wants to merge 1 commit intomagento:2.4-developfrom
Conversation
|
Hi @lbajsarowicz. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
|
The security team has been informed about this pull request due to the presence of risky security keywords. For security vulnerability reports, please visit Adobe's vulnerability disclosure program on HackerOne or email psirt@adobe.com. |
Description
Explicitly pass non-GraphQL requests carrying an
Authorizationheader, reproducing a built-in Varnish safety rule that Magento's unconditionalreturn (hash)bypasses.Problem
Magento's VCL templates end
vcl_recvwith an unconditionalreturn (hash). This means Varnish's built-invcl_recvnever runs, including its safety rule that passes requests withAuthorizationheaders.The existing bypass only covers authenticated GraphQL requests (checking for
Bearertoken + missingX-Magento-Cache-Id). Non-GraphQL requests with anyAuthorizationheader (e.g., REST API with Basic auth, third-party integrations) currently pass through toreturn (hash)and could be served from cache or pollute the cache with authenticated responses.Solution
Add an explicit pass rule for non-GraphQL requests with an
Authorizationheader:This preserves the existing GraphQL cache-ID logic while restoring the built-in safety behavior for all other authenticated traffic.
Files Changed
app/code/Magento/PageCache/etc/varnish4.vclapp/code/Magento/PageCache/etc/varnish5.vclapp/code/Magento/PageCache/etc/varnish6.vclapp/code/Magento/PageCache/etc/varnish7.vclRef #40673
⭐ Support my work
Do you like the fix? Remember to react with "👍🏻" to get it merged faster,
Then Sponsor me on Github so I can spend more time on fixing issues like this one.
Learn more at https://github.com/sponsors/lbajsarowicz