Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jszuminski
Copy link
Contributor

@jszuminski jszuminski commented Aug 13, 2024

Added #567, PUPPETEER_DIR made configurable.


Tasks

  • add PUPPETEER_DIR option
  • write a unit test for it being configurable
  • write a proper verifier in envs.js
  • test out the solution manually
  • update the changelog

@jszuminski jszuminski self-assigned this Aug 13, 2024
@jszuminski jszuminski linked an issue Aug 21, 2024 that may be closed by this pull request
Copy link
Contributor

@PaulDalek PaulDalek left a 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.

lib/schemas/config.js Outdated Show resolved Hide resolved
@PaulDalek PaulDalek self-requested a review September 19, 2024 13:40
Copy link
Contributor

@PaulDalek PaulDalek left a 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

This part of the regular expression may cause exponential backtracking on strings containing many repetitions of '-'.

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.

Suggested changeset 1
lib/envs.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/lib/envs.js b/lib/envs.js
--- a/lib/envs.js
+++ b/lib/envs.js
@@ -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
EOF
@@ -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
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@PaulDalek PaulDalek self-requested a review October 23, 2024 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v4: make userDataDir configurable
2 participants