Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(core): harden TransferState restoration against DOM clobbering - #69064

Merged
atscott merged 1 commit into
angular:mainfrom
JeanMeche:fix/transfer-state-clobering
Jun 3, 2026
Merged

fix(core): harden TransferState restoration against DOM clobbering#69064
atscott merged 1 commit into
angular:mainfrom
JeanMeche:fix/transfer-state-clobering

Conversation

@JeanMeche

Copy link
Copy Markdown
Member

Reject non-script elements when reading the SSR transfer state payload by id. This prevents attacker-controlled elements with a clobbered id from spoofing hydration state.

Reject non-script elements when reading the SSR transfer state payload by id.
This prevents attacker-controlled elements with a clobbered id from spoofing
hydration state.
@angular-robot angular-robot Bot added the area: core Issues related to the framework runtime label Jun 1, 2026
@ngbot ngbot Bot added this to the Backlog milestone Jun 1, 2026
@@ -154,7 +154,7 @@ export function retrieveTransferredState(
// Locate the script tag with the JSON data transferred from the server.
// The id of the script tag is set to the Angular appId + 'state'.
const script = doc.getElementById(appId + '-state');

@SkyZeroZx SkyZeroZx Jun 1, 2026

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.

I think we can use querySelectorAll, and if we find more than one match it throws an error (if I'm not mistaken, this only had one at a time).

By the way, I had reported this before, but I haven't received a response yet. I'm not sure if there might be any additional detail here that could help us.

https://issuetracker.google.com/u/1/issues/513386152

@alan-agius4 alan-agius4 added target: patch This PR is targeted for the next patch release action: merge The PR is ready for merge by the caretaker labels Jun 2, 2026
@ngbot

ngbot Bot commented Jun 2, 2026

Copy link
Copy Markdown

I see that you just added the action: merge label, but the following checks are still failing:
    failure status "google-internal-tests" is failing

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken main, please try rebasing to main and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@JeanMeche JeanMeche 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 Jun 2, 2026
@JeanMeche

Copy link
Copy Markdown
Member Author

caretaker note: presubmit failure is a flake, this is good to go

@atscott
atscott merged commit 6bde84f into angular:main Jun 3, 2026
27 of 29 checks passed
@atscott

atscott commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

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

@angular-automatic-lock-bot

Copy link
Copy Markdown

This pull request has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Jul 4, 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: core Issues related to the framework runtime merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants