fix: escape fallback raw-content ancestor tags in templates and processing instructions - #39
Merged
alan-agius4 merged 1 commit intoAug 20, 2026
Conversation
…ssing instructions Escape ancestor fallback raw-content element closing tags (e.g., </noscript>) when serializing ProcessingInstruction nodes, and when traversing DocumentFragment boundaries in <template> element content. - Updates HTMLTemplateElement to attach a _host reference to its content DocumentFragment, enabling fallbackRawContentTags() to continue ancestor traversal across <template> boundaries. - Escapes matching fallback raw-content ancestor tags in ProcessingInstruction data during HTML serialization (case 7 of serializeOne), matching the behavior of comment nodes. Addresses: - GHSA-v3p8-whq6-r5jg - angular/angular#70146
JeanMeche
approved these changes
Aug 20, 2026
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.
Escape ancestor fallback raw-content element closing tags (e.g.,
</noscript>) when serializingProcessingInstructionnodes and when traversingDocumentFragmentboundaries in<template>element content.<template>DocumentFragment Boundary (GHSA-v3p8-whq6-r5jg):<template>element stores its children in a separateDocumentFragment(template.content,nodeType === 11). BecausefallbackRawContentTags(node)previously only traversednodeType === 1elements, ancestor walks terminated at the fragment boundary without discovering enclosing fallback raw-content ancestors (such as<noscript>or<iframe>)._hostreference from the<template>element's_contentFragmentback to the host<template>element (and preserve this across deep cloning viacloneNode).fallbackRawContentTags(node)is updated to traverse from aDocumentFragmentnode to its_host, enabling discovery of fallback raw-content ancestors across template boundaries.ProcessingInstructionNodes (Incomplete fix for #70050 / #70055:</noscript>breakout still reachable through processing instructions angular#70146):serializeOne()(case 7: //PROCESSING_INSTRUCTION_NODE) previously only escaped>viaescapeProcessingInstructionContent(), without checking for matching fallback raw-content closing tags.case 8) logic: when PI data contains</, we checkfallbackRawContentTags(parent)and escape matching closing tags (e.g.,</noscript-></noscript).Fixes angular/angular#70146