Repository navigation
fix: include XSRF tokens in same-origin SSE requests - #543
Open
Pioneer-Weirdo wants to merge 1 commit into
Open
Pioneer-Weirdo wants to merge 1 commit into
Pioneer-Weirdo wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
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.
When the backend requires an XSRF cookie/header pair, streaming requests to
/run_sseomitX-XSRF-TOKENbecause native fetch bypasses Angular's HttpClient interceptor. Ordinary API requests already include it.Read the token through
HttpXsrfTokenExtractorfor each subscription and attach the default header to same-origin streaming requests. Resolve URLs against the document base URL and compare origins so external hosts, schemes, and ports do not receive the page's token. Add regression coverage for URL forms, cookie changes, absent and encoded cookies, invalid URLs, and cancellation.Fixes #459.
Validated on Windows with Node 24.19.0, Angular 21.2.22, and Chrome 154 after installing the committed lockfile with
npm ci:node node_modules/@angular/cli/bin/ng.js test agent_framework_web --watch=false --browsers=ChromeHeadlessCI --progress=false— 840 passed, 37 existing skips, 0 failures.node node_modules/@angular/cli/bin/ng.js build agent_framework_web --configuration=production --progress=false— passed.The regression was reproduced before the fix: an ordinary same-origin HttpClient POST included the token, while the streaming POST omitted it. Backend end-to-end validation was not performed.