From f937dc696275803cde3c26942271989f69279efe Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Thu, 7 Oct 2021 21:18:51 +0200 Subject: [PATCH] Fix regex DoS (#1533) Signed-off-by: Tilman Vatteroth --- .../editor-page/editor-pane/autocompletion/code-block.ts | 2 +- .../editor-page/editor-pane/autocompletion/container.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/editor-page/editor-pane/autocompletion/code-block.ts b/src/components/editor-page/editor-pane/autocompletion/code-block.ts index cff83b698..a9418d8f0 100644 --- a/src/components/editor-page/editor-pane/autocompletion/code-block.ts +++ b/src/components/editor-page/editor-pane/autocompletion/code-block.ts @@ -12,7 +12,7 @@ import { Logger } from '../../../../utils/logger' type highlightJsImport = typeof import('../../../common/hljs/hljs') const log = new Logger('Autocompletion > CodeBlock') -const wordRegExp = /^```((?:\w|-|_|\+)*)$/ +const wordRegExp = /^```((?:\w|-|\+)*)$/ let allSupportedLanguages: string[] = [] /** diff --git a/src/components/editor-page/editor-pane/autocompletion/container.ts b/src/components/editor-page/editor-pane/autocompletion/container.ts index 6448fb05f..aaff2fe55 100644 --- a/src/components/editor-page/editor-pane/autocompletion/container.ts +++ b/src/components/editor-page/editor-pane/autocompletion/container.ts @@ -8,7 +8,7 @@ import { Editor, Hint, Hints, Pos } from 'codemirror' import { validAlertLevels } from '../../../markdown-renderer/markdown-it-plugins/alert-container' import { findWordAtCursor, Hinter } from './index' -const wordRegExp = /^:::((?:\w|-|_|\+)*)$/ +const wordRegExp = /^:::((?:\w|-|\+)*)$/ const spoilerSuggestion: Hint = { text: ':::spoiler Toggle label\nToggled content\n::: \n', displayText: 'spoiler'