Skip to content

[20.3.x] fix(http): skip TransferCache for cookie-bearing and credentialed requests by default#68941

Merged
alxhub merged 2 commits into
angular:20.3.xfrom
alan-agius4:cherry-pick-67964-to-20.3.x
May 27, 2026
Merged

[20.3.x] fix(http): skip TransferCache for cookie-bearing and credentialed requests by default#68941
alxhub merged 2 commits into
angular:20.3.xfrom
alan-agius4:cherry-pick-67964-to-20.3.x

Conversation

@alan-agius4

Copy link
Copy Markdown
Contributor

This PR backports the TransferCache credentials and cookie safety fixes to the 20.3.x branch:

To compile correctly on 20.3.x where the modern transfer cache configurations are not yet present, CACHE_OPTIONS was successfully exported in transfer_cache.ts. All test suites pass cleanly.

Yenya030 added 2 commits May 27, 2026 07:28
Treat requests with a Cookie header like other auth-bearing requests and skip TransferCache caching them by default.

This preserves the explicit opt-in path via includeRequestsWithAuthHeaders, adds regression coverage for cookie-bearing requests, and updates the SSR guide to document the behavior.
Update the transfer cache check to safely exclude all requests sent with the `withCredentials` flag.

By default, the HTTP transfer cache avoids caching user-specific responses to prevent sensitive data exposure or incorrect caching. While requests with explicit headers like `Cookie` or `Authorization` are excluded by default, requests can also be sent with credentials via the `withCredentials` flag without having those headers explicitly declared on the request object.

To keep user-specific responses from being cached, exclude `withCredentials` requests unconditionally, even when the `includeRequestsWithAuthHeaders` option is set to true.
@pullapprove pullapprove Bot requested a review from AndrewKushnir May 27, 2026 07:29
@angular-robot angular-robot Bot added the area: common/http Issues related to HTTP and HTTP Client label May 27, 2026
@ngbot ngbot Bot added this to the Backlog milestone May 27, 2026
@alan-agius4 alan-agius4 requested review from JeanMeche and removed request for AndrewKushnir May 27, 2026 07:32
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker target: lts This PR is targeting a version currently in long-term support labels May 27, 2026
@alan-agius4 alan-agius4 added the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label May 27, 2026
@alan-agius4

Copy link
Copy Markdown
Contributor Author

caretaker note please ignore mergeability check

@alxhub alxhub merged commit de7b2a6 into angular:20.3.x May 27, 2026
30 of 36 checks passed
@alxhub

alxhub commented May 27, 2026

Copy link
Copy Markdown
Member

This PR was merged into the repository. The changes were merged into the following branches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: common/http Issues related to HTTP and HTTP Client merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: lts This PR is targeting a version currently in long-term support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants