fix: SSR Cache Poisoning via Unvalidated X-Forwarded-Host Header#21317
Open
fix: SSR Cache Poisoning via Unvalidated X-Forwarded-Host Header#21317
Conversation
Contributor
Merge Checks Failed |
spartacus
|
||||||||||||||||||||||||||||
| Project |
spartacus
|
| Branch Review |
CXSPA-12468
|
| Run status |
|
| Run duration | 04m 07s |
| Commit |
|
| Committer | Roman |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
3
|
|
|
0
|
|
|
0
|
|
|
101
|
| View all changes introduced in this branch ↗︎ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: https://jira.tools.sap/browse/CXSPA-12468
QA Steps
Prerequisites
The server starts at
http://localhost:4000. Keep the server terminal visible to observe the logs.Test 1: Verify default behavior (path-only cache key)
Goal: Confirm that
X-Forwarded-Hostdoes not affect the cache key.Step 1 — Send a first request
curl -s -o /dev/null -w "HTTP %{http_code}\n" http://localhost:4000/electronics-spa/en/USD/Expected server log — one render starts and completes:
Step 2 — Send the same request with a different
X-Forwarded-Host:Expected server log — the request is served from cache, no new
"Rendering started"messagePass criteria: Both requests use the same cache key
/electronics-spa/en/USD/. Only one render occurred.Test 2: Verify cache poisoning is no longer possible (concurrent burst)
Goal: Confirm that 20 concurrent requests with different
X-Forwarded-Hostvalues do NOT create 20 separate cache entries or exhaust concurrency.Step 1 — Restart the SSR server to clear the cache (Ctrl+C, then start again):
Step 2 — Send 20 concurrent requests with different
X-Forwarded-Hostheaders:Expected server logs — exactly one
"Rendering started"and one"Rendering completed", with all 20 requests waiting on and resolved by that single render:Pass criteria:
"Concurrency limit exceeded"messages)"fallbacking to CSR"messages (with 30s timeout)