fix(compiler): disallow i18n resource url attributes (XSS)#68580
Closed
Hexix23 wants to merge 1 commit intoangular:mainfrom
Closed
fix(compiler): disallow i18n resource url attributes (XSS)#68580Hexix23 wants to merge 1 commit intoangular:mainfrom
Hexix23 wants to merge 1 commit intoangular:mainfrom
Conversation
Reject translated ResourceURL attributes so localization cannot replace source-approved script URLs with executable resources.
This was referenced May 6, 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.
This fix addresses a Cross-Site Scripting (XSS, CWE-79) issue in Angular's i18n compiler handling for static
ResourceURLattributes.The issue was found during Google OSS VRP research, and this PR follows the public maintainer PR path requested for Angular product-security fixes.
Angular already classifies SVG
script|hrefasSecurityContext.RESOURCE_URL, but the i18n metadata gate only rejected translated attributes that appear in the Trusted Types sink list.script|hrefis not in that list, so a localized build could replace a source-approved SVG script href with a translated script resource URL.Changes:
SecurityContext.RESOURCE_URL<script href>ResourceURL attributesSecurity impact verified:
<script href>value as a static template attributebypassSecurityTrust*, custom renderer, custom sanitizer, or direct DOM writesOut of scope:
SecurityContext.RESOURCE_URLtranslated static attributes. Other i18n security-context hardening work can remain separate.PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
Angular's i18n metadata pass rejects translated attributes only when
isTrustedTypesSink()returns true. It does not also consult Angular's DOM security schema forSecurityContext.RESOURCE_URLattributes. As a result, static translated SVGscript|hrefattributes can be emitted into localized AOT output even though the schema classifiesscript|hrefas a ResourceURL sink.What is the new behavior?
Translated static attributes are rejected when the target DOM attribute is classified as
SecurityContext.RESOURCE_URL, while preserving the previous Trusted Types sink rejection behavior.This prevents localization data from replacing source-approved SVG script href values with executable script resources in localized builds.
Does this PR introduce a breaking change?
Other information
Local validation run: