diff --git a/src/components/render-page/window-post-message-communicator/window-post-message-communicator.ts b/src/components/render-page/window-post-message-communicator/window-post-message-communicator.ts index 5c4b8dbc4..8f8a451e4 100644 --- a/src/components/render-page/window-post-message-communicator/window-post-message-communicator.ts +++ b/src/components/render-page/window-post-message-communicator/window-post-message-communicator.ts @@ -151,6 +151,9 @@ export abstract class WindowPostMessageCommunicator< * @return {@link true} if the event was processed. */ protected handleEvent(event: MessageEvent>): void { + if (event.origin !== this.targetOrigin) { + return + } Optional.ofNullable(event.data) .filter((value) => value.uuid === this.uuid) .ifPresent((payload) => { diff --git a/src/extensions/extra-integrations/gist/replace-gist-link.ts b/src/extensions/extra-integrations/gist/replace-gist-link.ts index ef1034066..9c3f424cd 100644 --- a/src/extensions/extra-integrations/gist/replace-gist-link.ts +++ b/src/extensions/extra-integrations/gist/replace-gist-link.ts @@ -7,12 +7,7 @@ import { GistMarkdownExtension } from './gist-markdown-extension' import type { RegexOptions } from '../../../external-types/markdown-it-regex/interface' -const protocolRegex = /(?:http(?:s)?:\/\/)?/ -const domainRegex = /(?:gist\.github\.com\/)/ -const idRegex = /(\w+\/\w+)/ -const tailRegex = /(?:[./?#].*)?/ -const gistUrlRegex = new RegExp(`(?:${protocolRegex.source}${domainRegex.source}${idRegex.source}${tailRegex.source})`) -const linkRegex = new RegExp(`^${gistUrlRegex.source}$`, 'i') +const linkRegex = /^(?:https?:\/\/)?gist\.github\.com\/(\w+\/\w+)(?:[./?#].*)?$/i /** * Replacer for gist links. diff --git a/src/extensions/extra-integrations/vimeo/__snapshots__/vimeo-frame.test.tsx.snap b/src/extensions/extra-integrations/vimeo/__snapshots__/vimeo-frame.test.tsx.snap index 4557bd224..5cf521d31 100644 --- a/src/extensions/extra-integrations/vimeo/__snapshots__/vimeo-frame.test.tsx.snap +++ b/src/extensions/extra-integrations/vimeo/__snapshots__/vimeo-frame.test.tsx.snap @@ -10,8 +10,8 @@ exports[`VimeoFrame renders a click shield 1`] = `