From a17ec1c5f9a6f2c5cf3e967c22a77c878b74bb19 Mon Sep 17 00:00:00 2001 From: tzhangchi Date: Wed, 17 Aug 2022 10:18:02 +0800 Subject: [PATCH] fix(youtube): Incomplete URL substring sanitization --- libs/components/editor-blocks/src/blocks/youtube/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/components/editor-blocks/src/blocks/youtube/index.ts b/libs/components/editor-blocks/src/blocks/youtube/index.ts index 363e7d78a9..26e4117961 100644 --- a/libs/components/editor-blocks/src/blocks/youtube/index.ts +++ b/libs/components/editor-blocks/src/blocks/youtube/index.ts @@ -19,7 +19,9 @@ export class YoutubeBlock extends BaseView { const tag_name = el.tagName; if (tag_name === 'A' && el.parentElement?.childElementCount === 1) { const href = el.getAttribute('href'); - if (href.indexOf('.youtube.com') !== -1) { + const allowedHosts = ['.youtube.com']; + + if (allowedHosts.includes(href)) { return [ { type: this.type,