Skip to content

fix: Escapes in raw text #29

Merged
alan-agius4 merged 3 commits into
angular:mainfrom
SkyZeroZx:fix/xss-noscript
May 26, 2026
Merged

fix: Escapes in raw text #29
alan-agius4 merged 3 commits into
angular:mainfrom
SkyZeroZx:fix/xss-noscript

Conversation

@SkyZeroZx

@SkyZeroZx SkyZeroZx commented May 23, 2026

Copy link
Copy Markdown

fix: Escapes </noscript in raw text when scripting enabled

Ensuring raw text within <noscript> elements is properly escaped during serialization if scripting is enabled. Adds a test to verify controlled payloads cannot break out of <noscript> and inject scripts.

Fixes angular/angular#68903

fix: fix raw-text element serialization

Correct raw-text closing-tag escaping so astral Unicode characters cannot
misalign the escaped < character. This prevents serialized raw-text content
from breaking out into executable markup such as </iframe><script>.

Prevents XSS by ensuring raw text within `<noscript>` elements is properly escaped during serialization if scripting is enabled.
Adds a test to verify controlled payloads cannot break out of `<noscript>` and inject scripts.

Fixes angular/angular#68903
@alan-agius4 alan-agius4 self-requested a review May 24, 2026 07:34
Correct raw-text closing-tag escaping so astral Unicode characters cannot
misalign the escaped `<` character. This prevents serialized raw-text content
from breaking out into executable markup such as `</iframe><script>`.
Comment thread lib/NodeUtils.js
// (`[...rawText]`). Astral characters (e.g. emoji) before the match
// would otherwise shift the replacement and leave a real `</tag>`
// break-out in the output.
return rawText.replace(

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I was doing some regression testing and also found this issue with iframe and TextContent using astral characters like '😀', so we'll fix it in the same PR; it's added as another commit.

@SkyZeroZx SkyZeroZx changed the title fix: Escapes </noscript in raw text when scripting enabled fix: Escapes in raw text May 25, 2026
Comment thread lib/NodeUtils.js Outdated

@alan-agius4 alan-agius4 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@alan-agius4 alan-agius4 merged commit f74cccd into angular:main May 26, 2026
7 checks passed
@SkyZeroZx

SkyZeroZx commented May 28, 2026

Copy link
Copy Markdown
Author

@alan-agius4 Sorry for bothering. I think it would be worth mentioning this in the release notes for the latest Angular patches and, if applicable, generating an CVE/Advisor notice, since in SSR this could have been considered an XSS vector.

alan-agius4 added a commit to alan-agius4/angular that referenced this pull request May 29, 2026
Updates the domino dependency to the latest version as used in the main branch.

This update contains fixes for angular/domino#29.
alan-agius4 added a commit to alan-agius4/angular that referenced this pull request May 29, 2026
Updates the domino dependency to the latest version as used in the main branch.

This update contains fixes for angular/domino#29.
alan-agius4 added a commit to alan-agius4/angular that referenced this pull request May 29, 2026
Updates the domino dependency to the latest version as used in the main branch.

This update contains fixes for angular/domino#29.
alan-agius4 added a commit to alan-agius4/angular that referenced this pull request May 29, 2026
Updates the domino dependency to the latest version as used in the main branch.

This update contains fixes for angular/domino#29.
alan-agius4 added a commit to alan-agius4/angular that referenced this pull request May 29, 2026
Updates the domino dependency to the latest version as used in the main branch.

This update contains fixes for angular/domino#29.
pkozlowski-opensource pushed a commit to angular/angular that referenced this pull request May 29, 2026
Updates the domino dependency to the latest version as used in the main branch.

This update contains fixes for angular/domino#29.
pkozlowski-opensource pushed a commit to angular/angular that referenced this pull request May 29, 2026
Updates the domino dependency to the latest version as used in the main branch.

This update contains fixes for angular/domino#29.
pkozlowski-opensource pushed a commit to angular/angular that referenced this pull request May 29, 2026
Updates the domino dependency to the latest version as used in the main branch.

This update contains fixes for angular/domino#29.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

<noscript> text serialization in Angular SSR

2 participants