Repository navigation
fix(core): use the custom Sanitizer for URLs in i18n attributes - #72035
Merged
Merged
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. |
phr4nky
force-pushed
the
fix-i18n-custom-url-sanitizer
branch
from
November 13, 2026 16:46
57f5a11 to
98ebad6
Compare
5 tasks done
JeanMeche
approved these changes
Nov 16, 2026
phr4nky
force-pushed
the
fix-i18n-custom-url-sanitizer
branch
from
November 16, 2026 15:47
98ebad6 to
4cdd48b
Compare
Translated attributes with interpolations in a URL context (e.g.
`<a i18n-href href="{{url}}">` or an `href` inside an ICU case) were
sanitized with the raw `_sanitizeUrl` function, which ignores a
`Sanitizer` provided by the application. All other security contexts
already go through the `ɵɵsanitize*` instructions, as does the
compile-time path for static i18n attributes.
Use `ɵɵsanitizeUrl` for the URL context as well, so a custom
`Sanitizer` is consulted consistently.
phr4nky
force-pushed
the
fix-i18n-custom-url-sanitizer
branch
from
November 16, 2026 19:46
4cdd48b to
b912325
Compare
thePunderWoman
approved these changes
Nov 16, 2026
Contributor
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.
PR Checklist
PR Type
What is the current behavior?
Translated attributes with interpolations in a URL context, e.g.
are sanitized at runtime by
i18nResolveSanitizerwith the raw_sanitizeUrlfunction. Unlike theɵɵsanitize*instructions, it does not consult aSanitizerprovided by the application ({provide: Sanitizer, useValue: ...}). All other security contexts (HTML, style, script, resource URL) in the same function already use theɵɵsanitize*instructions, and the compile-time path for static i18n attributes emitsɵɵsanitizeUrlas well, so URLs were the only inconsistent case.Issue Number: N/A
What is the new behavior?
i18nResolveSanitizerreturnsɵɵsanitizeUrlfor the URL context, so a customSanitizeris used for translated URL attributes just like for regular bindings. Without a customSanitizerthe behavior is unchanged (ɵɵsanitizeUrlfalls back to_sanitizeUrl).The new tests in
i18n_spec.tsfail without the change (Expected 'unsafe:javascript:…' to be 'custom:javascript:…') and pass with it.Does this PR introduce a breaking change?