-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat/567-user-data-dir-config #569
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work! Only one small comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work! Only one small comment.
.refine( | ||
(value) => { | ||
// Simplified regex to match both absolute and relative paths | ||
return /^(\.\/|\.\.\/|\/|[a-zA-Z]:\\|[a-zA-Z]:\/)?([\w-]+[\\/]?)+$/.test( |
Check failure
Code scanning / CodeQL
Inefficient regular expression High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 2 months ago
To fix the problem, we need to modify the regular expression to remove the ambiguity that leads to exponential backtracking. Specifically, we should ensure that the -
character is not ambiguously included in the \w
character class. One way to achieve this is to explicitly exclude the hyphen from the \w
character class and handle it separately.
The best way to fix this without changing the existing functionality is to use a non-ambiguous character class that clearly separates the hyphen from the word characters. We can use a character class that includes word characters and underscores, and then explicitly add the hyphen as an alternative.
-
Copy modified line R75
@@ -74,3 +74,3 @@ | ||
// Simplified regex to match both absolute and relative paths | ||
return /^(\.\/|\.\.\/|\/|[a-zA-Z]:\\|[a-zA-Z]:\/)?([\w-]+[\\/]?)+$/.test( | ||
return /^(\.\/|\.\.\/|\/|[a-zA-Z]:\\|[a-zA-Z]:\/)?(([\w]+|-)[\\/]?)+$/.test( | ||
value |
Added #567, PUPPETEER_DIR made configurable.
Tasks
PUPPETEER_DIR
optionenvs.js