fix(compiler): disallow i18n on svg animation attributes (XSS)#68560
fix(compiler): disallow i18n on svg animation attributes (XSS)#68560Hexix23 wants to merge 1 commit into
Conversation
josephperrott
left a comment
There was a problem hiding this comment.
LGTM
Reviewed-for: fw-security
Reject translated SVG animation attributes so localization cannot retarget safe animations to href values.
73e30b5 to
2b5d59e
Compare
|
Woah, looks like you've opened a lot of issues/PRs recently. While we appreciate contributions from the community, triaging and reviewing a large influx of content in a short time period takes time away from other ongoing projects. As a result, we're closing these issues/PRs to maintain the team's focus. Note that this is not necessarily a rejection of the goals or direction of any of these contributions in particular, so much as a reflection of the team's current capacity and priorities. You are welcome to open a smaller subset of issues/PRs in accordance with our policy focused on the most important and impactful contributions and we will do our best to prioritize a response as soon as possible. |
Hi Alan, All the reports I have opened were originally submitted through your VRP platform. They have been sitting there for a while without a response, or some were closed instructing me to report them this way (although, according to the documentation, I understood the standard procedure was the other way around). This explains the high volume of reports. This is the last finding I had (despite having lost some duplicates due to this change in the process). As you can verify, they are all reproducible and, being XSS vulnerabilities, they hold an average rating of Medium Severity. Thank you very much! |
|
@alan-agius4 The other bugs have been fixed. Could you take another look at the PR and check the comments? Thanks, and sorry for the trouble :) |
|
This also will be handled by #68591 |
|
Thanks for confirming! So we can conclude that it was a security risk, right? @alan-agius4 |
|
It’s a possibility, but the risk is pretty low since someone would have to inject the malicious content in the translations first. Still, it’s a good move for hardening the system. |
This fix addresses a security issue in the Angular compiler i18n metadata pass.
Summary: Angular i18n SVG retargets safe animation into executable href.
The change follows a Google OSS VRP review that asked for the issue to be
handled through the Angular GitHub workflow for disclosure and remediation.
i18n-*attributes were rejected when they targeted Trusted Types sinks, butthey were not rejected when they targeted SVG animation attributes that Angular's
own DOM security schema marks as
SecurityContext.ATTRIBUTE_NO_BINDING.This allowed localized static SVG animation attributes to bypass the same
security-sensitive attribute restrictions that Angular already enforces for
dynamic bindings. SVG animation attributes such as
attributeNameandtocanretarget an otherwise safe animation into a security-sensitive link target at
runtime.
Changes:
schema in addition to the existing Trusted Types sink check.
i18n-*metadata for SVG animation attributes whose security contextis
SecurityContext.ATTRIBUTE_NO_BINDING.elements such as
:svg:setare checked against the same schema entries asdynamic bindings.
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 visitor only rejects translated attributes when
isTrustedTypesSink(tagName, attrName)returns true.SVG animation attributes that are marked in
dom_security_schema.tsasSecurityContext.ATTRIBUTE_NO_BINDINGare not rejected by the i18n metadatapass. As a result, localized static SVG animation attributes can be emitted even
though Angular blocks equivalent dynamic bindings.
What is the new behavior?
Translated SVG animation attributes are rejected when Angular's DOM security
schema marks them as
SecurityContext.ATTRIBUTE_NO_BINDING.Does this PR introduce a breaking change?
Other information
Validated locally with:
bazelisk test //packages/core/test:test --test_filter='security integration tests translation'bazelisk test //packages/compiler/test:test --test_filter='i18n'npx --yes prettier@3.8.0 --check packages/compiler/src/render3/view/i18n/meta.ts packages/core/test/linker/security_integration_spec.tsgit diff --check -- packages/compiler/src/render3/view/i18n/meta.ts packages/core/test/linker/security_integration_spec.ts