Title: ResourceURL sanitizer bypass through host-binding selector mismatch · Issue #69550 · angular/angular · GitHub
Open Graph Title: ResourceURL sanitizer bypass through host-binding selector mismatch · Issue #69550 · angular/angular
X Title: ResourceURL sanitizer bypass through host-binding selector mismatch · Issue #69550 · angular/angular
Description: Which @angular/* package(s) are the source of the bug? compiler/core Is this a regression? No Description Angular can choose the security context for a host binding from compile-time selector information, then later run that compiled hos...
Open Graph Description: Which @angular/* package(s) are the source of the bug? compiler/core Is this a regression? No Description Angular can choose the security context for a host binding from compile-time selector infor...
X Description: Which @angular/* package(s) are the source of the bug? compiler/core Is this a regression? No Description Angular can choose the security context for a host binding from compile-time selector infor...
Opengraph URL: https://github.com/angular/angular/issues/69550
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ResourceURL sanitizer bypass through host-binding selector mismatch","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\ncompiler/core\n\n### Is this a regression?\n\nNo\n\n### Description\n\n\nAngular can choose the security context for a host binding from compile-time selector information, then later run that compiled host binding on a different concrete runtime host element.\n\nThis becomes unsafe when the selector used during compilation is not a sensitive element, but the runtime host is a sensitive browser sink such as:\n\n- `iframe[srcdoc]`\n- `iframe[src]`\n- `object[data]`\n- `a[href]`\n\nIn those cases Angular may emit or reuse host-binding code equivalent to:\n\n```ts\nattribute('srcdoc', ctx.srcdoc);\nattribute('src', ctx.src);\nattribute('data', ctx.data);\n```\n\n\ninstead of applying sink-specific sanitization such as HTML sanitization for `iframe[srcdoc]` or ResourceURL enforcement for `iframe[src]` / `object[data]`.\n\n### Affected composition paths\n\nThe same mismatch can be reached through at least these public Angular composition paths:\n\n- `hostDirectives`\n- inherited host bindings\n- pure `:not(...)` selectors\n- `createComponent(..., {directives})`\n\n\n## Cases \n\n### 1. `hostDirectives` selector mismatch\n\nThe host directive is compiled from a custom-element selector where `attr.srcdoc` is not treated as an `iframe[srcdoc]` sink. The compiled host binding is then reused on an actual `iframe` host.\n\n\n### 2. Inherited host-binding selector mismatch\n\nThe base directive host binding is compiled from a non-sensitive selector, then inherited by a component/directive whose runtime host is an `iframe`.\n\n\n### 3. Pure `:not(...)` selector under-approximation\n\nA pure `:not(...)` selector does not name the positive runtime element. Angular can compile the host binding without knowing that it will later run on an `iframe`.\n\n### 4. Dynamic `createComponent(..., {directives})` mismatch\n\nThis is the smallest self-contained case for an issue report. A component creates a real `iframe` host, then dynamically applies a directive whose host binding was compiled from a safe custom selector.\n\n\n## Related ResourceURL sinks\n\nThe same selector/runtime-host mismatch also affects document-loading sinks that should require ResourceURL handling, for example: `[attr.src]` & `[attr.data]`\n\n\n## Root cause\n\nThe sanitizer decision is bound too early or too narrowly for host bindings. Public composition APIs can later move or reuse a host binding on a different runtime host element. Dynamic component creation can also create a sensitive host element from a component selector and then write a host-bound sensitive sink.\n\nWhen the final host/sink has a stricter security context than the compiled host binding applies, the write is not reclassified.\n\nIn short:\n\n```text\ncompiled host binding says: no sanitizer / weaker sanitizer\nfinal host is: iframe, script, or object\nbinding writes: srcdoc/src/data\nAngular uses: compiled weak/no-sanitizer context\nbrowser receives: raw sensitive sink value\n```\n\n### Please provide a link to a minimal reproduction of the bug\n\nhttps://issuetracker.google.com/u/1/issues/513926480\n","author":{"url":"https://github.com/SkyZeroZx","@type":"Person","name":"SkyZeroZx"},"datePublished":"2026-06-27T21:03:00Z","url":"https://github.com/angular/angular/issues/69550"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d8adaade-9487-2e16-516d-7051535bcbf2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8A22:52913:73487:A2CC7:6AFDEE63 |
| html-safe-nonce | ed5a2f318745d0e128bdc5bc90a214fb95f6d978917567c467e8dfa2ee599ce7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QTIyOjUyOTEzOjczNDg3OkEyQ0M3OjZBRkRFRTYzIiwidmlzaXRvcl9pZCI6IjMwOTEzMzY2ODYyODIzMzc4OTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1a587647c0ec5703a7e82e44ac321d12ea8890cc556d572ef19ef07c75ecbc19 |
| hovercard-subject-tag | issue:4759927142 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/69550/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8fdc1f20171711ad9f87d92da5d7d35c7995a43b387608af1aa8282e547b8183/angular/angular/issues/69550 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8fdc1f20171711ad9f87d92da5d7d35c7995a43b387608af1aa8282e547b8183/angular/angular/issues/69550 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? compiler/core Is this a regression? No Description Angular can choose the security context for a host binding from compile-time selector infor... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | SkyZeroZx |
| hostname | github.com |
| expected-hostname | github.com |
| None | dd812ec581ecac95855f5ec917ef9827506c39a9da1443f43ddb4179a46471eb |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 32ac708bac264dafdc28e10ff49b4d137f0c34a7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width