Skip to content

fix: Use magic-string appendLeft instead of replace#303

Merged
lforst merged 1 commit into
mainfrom
lforst-attempt-fixing-faulty-injection-logic
Jun 6, 2023
Merged

fix: Use magic-string appendLeft instead of replace#303
lforst merged 1 commit into
mainfrom
lforst-attempt-fixing-faulty-injection-logic

Conversation

@lforst
Copy link
Copy Markdown

@lforst lforst commented Jun 6, 2023

This is an experimental fix that might resolve #298

I tried a bunch of things with our RegExp to understand whether it is wrong but couldn't reproduce the examined outcome.

This led me to believe that there is something going on inside the magic-string library that might cause the issue. This is an experimental fix that should be equivalent in behaviour but will hopefully resolve the issue.

@lforst lforst requested a review from mydea June 6, 2023 12:19
/^(?:\s*|\/\*(?:.|\r|\n)*\*\/|\/\/.*[\n\r])*(?:"[^"]*";|'[^']*';)?/;

if (code.match(commentUseStrictRegex)?.[0]) {
const match = code.match(commentUseStrictRegex)?.[0];

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data

This [regular expression](1) that depends on [library input](2) may run slow on strings starting with '//' and with many repetitions of '*///'.
@lforst lforst merged commit b02821a into main Jun 6, 2023
@lforst lforst deleted the lforst-attempt-fixing-faulty-injection-logic branch June 6, 2023 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ERROR: Unexpected ";" when using sentryVitePlugin

3 participants