Skip to content

fix(core): sanitize meta selectors - #68836

Merged
alxhub merged 2 commits into
angular:mainfrom
JeanMeche:fix/meta-selector
May 27, 2026
Merged

fix(core): sanitize meta selectors#68836
alxhub merged 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
Comment thread packages/platform-browser/src/browser/meta.ts
@@ -102,7 +102,8 @@ export class Meta {
*/
getTag(attrSelector: string): HTMLMetaElement | null {
if (!attrSelector) return null;
return this._doc.querySelector(`meta[${attrSelector}]`) || null;
const meta = this._doc.querySelector(`meta[${attrSelector}]`);
return meta?.nodeName.toLowerCase() === 'meta' ? meta : null;

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: should we create a helper method like isMetaTag to avoid repetition and also minimize the risk of logic divergence in the future?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll do that in the followup cleanup !

@JeanMeche
JeanMeche removed the request for review from atscott May 22, 2026 20:30
@JeanMeche JeanMeche added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels May 22, 2026
@alxhub
alxhub merged commit d5a489a into angular:main May 27, 2026
22 checks passed
@alxhub

alxhub commented May 27, 2026

Copy link
Copy Markdown
Member

This PR was merged into the repository. The changes were merged into the following branches:

@JeanMeche
JeanMeche deleted the fix/meta-selector branch June 23, 2026 13:41
@angular-automatic-lock-bot

Copy link
Copy Markdown

This pull request has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Jul 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants