Skip to content

fix(compiler): expand security schema for URL sinks#68409

Open
izzettin-ahmet wants to merge 2 commits intoangular:mainfrom
izzettin-ahmet:fix-schema-url-sinks
Open

fix(compiler): expand security schema for URL sinks#68409
izzettin-ahmet wants to merge 2 commits intoangular:mainfrom
izzettin-ahmet:fix-schema-url-sinks

Conversation

@izzettin-ahmet
Copy link
Copy Markdown

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • [x ] Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Currently, several element-attribute pairs that function as URL or Resource URL sinks are not registered in the DomSanitizer security schema (SECURITY_SCHEMA). This means that values bound to these properties (e.g., meta[content], table[background], or svg:use[href]) are not automatically validated against Angular's security contexts at compile time.

Issue Number: N/A (Proactive security hardening)

What is the new behavior?

This PR expands the dom_security_schema.ts to include these missing sinks.

meta|content and background attributes are now registered under SecurityContext.URL.
use|href and use|xlink:href are now registered under SecurityContext.RESOURCE_URL.
This ensures the framework provides "Secure by Default" protection for these attributes by generating the appropriate ɵɵsanitizeUrl or ɵɵsanitizeResourceUrl instructions.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

This update aligns the Angular security schema with modern browser behaviors and MDN standards for URL-handling attributes. By registering these sinks, we provide a consistent defense-in-depth posture across all valid HTML and SVG resource-loading paths.

@angular-robot angular-robot Bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Apr 27, 2026
@ngbot ngbot Bot added this to the Backlog milestone Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: compiler Issues related to `ngc`, Angular's template compiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant