fix(http): enable XSRF protection for same-origin absolute URLs by alan-agius4 · Pull Request #65683 · angular/angular · GitHub
Skip to content

fix(http): enable XSRF protection for same-origin absolute URLs - #65683

Merged
pkozlowski-opensource merged 4 commits into
angular:mainfrom
alan-agius4:xsrf-origin
Dec 3, 2025
Merged

pkozlowski-opensource merged 4 commits into
angular:mainfrom
alan-agius4:xsrf-origin

Conversation

@alan-agius4

Copy link
Copy Markdown
Contributor

Previously, the XSRF interceptor only added the XSRF token to requests with relative URLs. This commit updates the interceptor to also add the token to requests with absolute URLs, provided they match the current origin.

Closes #20511

@alan-agius4
alan-agius4 requested a review from hybrist November 27, 2025 08:21
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Nov 27, 2025
@angular-robot angular-robot Bot added the area: common/http Issues related to HTTP and HTTP Client label Nov 27, 2025
@ngbot ngbot Bot added this to the Backlog milestone Nov 27, 2025
Comment thread adev/src/content/guide/http/security.md Outdated
@alan-agius4
alan-agius4 removed the request for review from devversion November 27, 2025 13:50
@MrSatyam77

This comment was marked as off-topic.

@alan-agius4

This comment was marked as off-topic.

@josephperrott josephperrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Reviewed-for: fw-security

@jelbourn jelbourn 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.

LGTM

Reviewed-for: fw-security

Comment thread adev/src/content/guide/http/security.md Outdated
Comment thread adev/src/content/guide/security.md Outdated
Comment thread packages/common/http/src/xsrf.ts Outdated
@pullapprove
pullapprove Bot requested a review from devversion December 2, 2025 17:16
Previously, the XSRF interceptor only added the XSRF token to requests with relative URLs.
This commit updates the interceptor to also add the token to requests with absolute URLs, provided they match the current origin.

Closes angular#20511
@alan-agius4
alan-agius4 removed the request for review from devversion December 2, 2025 21:35
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 2, 2025
@pullapprove
pullapprove Bot requested a review from devversion December 2, 2025 21:35
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer and removed action: merge The PR is ready for merge by the caretaker labels Dec 2, 2025
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 3, 2025
@pkozlowski-opensource
pkozlowski-opensource merged commit 0659d11 into angular:main Dec 3, 2025
24 checks passed
@pkozlowski-opensource

Copy link
Copy Markdown
Member

@alan-agius4
alan-agius4 deleted the xsrf-origin branch December 3, 2025 11:25
@dmurvihill

Copy link
Copy Markdown

Oh my god @alan-agius4, you are a rock star. This issue caused so many tears across the whole ecosystem

@angular-automatic-lock-bot

Copy link
Copy Markdown

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Jan 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: common/http Issues related to HTTP and HTTP Client target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HttpClient does not set X-XSRF-Token on Http Post

8 participants