Skip to content

fix(core): sanitize meta selectors#68836

Open
JeanMeche wants to merge 2 commits into
angular:mainfrom
JeanMeche:fix/meta-selector
Open

fix(core): sanitize meta selectors#68836
JeanMeche wants to merge 2 commits into
angular:mainfrom
JeanMeche:fix/meta-selector

Conversation

@JeanMeche
Copy link
Copy Markdown
Member

Ensure that property/name are correctly escaped and doesn't break out of the intended selector.

Ensure that property/name are correctly escaped and doesn't break out of the intended selector.
@angular-robot angular-robot Bot added the area: core Issues related to the framework runtime label May 20, 2026
@ngbot ngbot Bot added this to the Backlog milestone May 20, 2026
@JeanMeche JeanMeche force-pushed the fix/meta-selector branch from de1a51b to 173f47e Compare May 21, 2026 00:27
@JeanMeche JeanMeche force-pushed the fix/meta-selector branch from 173f47e to c2dcf4e Compare May 21, 2026 01:02
@@ -114,7 +115,11 @@ export class Meta {
getTags(attrSelector: string): HTMLMetaElement[] {
if (!attrSelector) return [];
const list /*NodeList*/ = this._doc.querySelectorAll(`meta[${attrSelector}]`);
return list ? [].slice.call(list) : [];
return list
? (([].slice.call(list) as HTMLElement[]).filter(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT:

Not sure why _doc in the constructor is any in this case, which does cause the need for castings.

Suggested change
? (([].slice.call(list) as HTMLElement[]).filter(
? ((Array.from(list) as HTMLElement[]).filter(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Issues related to the framework runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants