fix(compiler): disallow i18n on iframe policy attributes (XSS)#68559
fix(compiler): disallow i18n on iframe policy attributes (XSS)#68559Hexix23 wants to merge 1 commit into
Conversation
Reject translated iframe policy attributes so localization cannot relax sandbox and permissions controls.
9c9408e to
d39ac76
Compare
|
Thanks for the contribution. We agree there is a security concern here, but this implementation isn't the correct approach. Refer to PR #68591 for more context. |
|
I’ll treat this PR as superseded by #68591. My implementation handled this as a narrow rejection in the i18n metadata path, while #68591 appears to address the broader root cause by resolving i18n static attributes through Angular’s DOM security schema and applying the correct sanitizer or validateAttribute path. For disclosure traceability, I understand this PR was closed because the proposed implementation was not the desired fix approach, not because the underlying issue was invalid. Your comment confirms there is a security concern here. The concrete case covered by this PR was translated iframe policy attributes such as sandbox, csp, referrerpolicy, and allow. Those attributes are security-sensitive because changing them can relax iframe sandboxing, CSP, referrer leakage, or Permissions Policy controls. The issue was that static translated i18n attributes could bypass the same framework security handling that Angular applies to equivalent security-sensitive bindings. I’ll reference #68591 as the canonical maintainer-owned remediation path for this issue. |
I understand, and we will discuss this further with the team since this issue extends beyond iframes to all security-sensitive attributes. While we agree on the issues, our concerns lies in the implementation strategy. We should avoid fragmented logic and instead rely on a centralized validator within the DOM schema, if necessary, implement a stricter validator to prevent static values from being overridden. We'll finalize the approach during our internal team discussion. |
|
Thanks @alan-agius4 , I reviewed #68591 locally and I agree this is the right hardening direction. The main improvement is that the i18n decision becomes schema-driven instead of being tied to each individual reported attribute. That matches the invariant behind the related reports:
The security-context mapping in #68591 looks correct to me:
A couple of hardening details may be worth keeping in the final version:
The current tests already map well to the disclosed cases: URL attributes, SVG script ResourceURL attributes, iframe policy attributes, SVG SMIL retargeting, and a non-sensitive negative control. If namespace-prefixed SVG/MathML coverage is also included, #68591 looks like the correct maintainer-owned remediation path for the related security reports. For context, this appears to cover the concrete cases I reported in #68557, #68559, #68560, and #68580. My priority here is to make sure the hardening is complete and robust; if there is anything else I can validate or adjust from the reporter side, happy to help. |
This fix addresses a security issue in the Angular compiler i18n metadata pass.
Summary: Angular i18n lets translated iframe policy attributes relax sandbox, CSP, referrerPolicy, and Permissions Policy controls.
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 iframe attributes that Angular's own
DOM security schema marks as
SecurityContext.ATTRIBUTE_NO_BINDING.This allowed localized static iframe policy attributes to bypass the same
security-sensitive attribute restrictions that Angular already enforces for
dynamic bindings.
Changes:
schema in addition to the existing Trusted Types sink check.
i18n-*metadata for iframe attributes whose security context isSecurityContext.ATTRIBUTE_NO_BINDING.sandbox.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.Iframe policy attributes that are marked in
dom_security_schema.tsasSecurityContext.ATTRIBUTE_NO_BINDINGare not rejected by the i18n metadatapass. As a result, localized static iframe policy attributes can be emitted even
though Angular blocks equivalent dynamic bindings.
What is the new behavior?
Translated iframe policy 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/acceptance:acceptance --test_filter='iframe processing'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/acceptance/security_spec.tsgit diff --check -- packages/compiler/src/render3/view/i18n/meta.ts packages/core/test/acceptance/security_spec.ts