fix(core): sanitize anchor protocol bindings#69219
Open
SkyZeroZx wants to merge 1 commit into
Open
Conversation
Treat `protocol` property bindings on `<a>` and `<area>` as URL contexts. This prevents a sanitized `href` from being re-schemed into an executable `javascript:` URL by a later protocol property write.
915e1ae to
00a7f6f
Compare
alan-agius4
requested changes
Jun 8, 2026
Contributor
There was a problem hiding this comment.
I'm not entirely sure this is the right fix. The root issue might lies in the schema itself: https://github.com/angular/angular/blob/255151a41349c519728651739412dbd0f6138e13/packages/compiler/src/schema/dom_element_schema_registry.ts%23L99-L100
Setting protocol directly on element isn't really valid. We should dig a bit deeper into why this was originally introduced, as there are a few other invalid properties listed there as well.
Let me check with the team to see if this is by design.
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.
Treat
protocolproperty bindings on<a>and<area>as URL contexts.This prevents a sanitized
hreffrom being re-schemed into an executablejavascript:URL by a later protocol property write.See https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/protocol
More context https://issuetracker.google.com/u/1/issues/520794065