-
-
Notifications
You must be signed in to change notification settings - Fork 207
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
🐛 fix: Align cache hashes #1248
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
9d0029e
to
9f4ef40
Compare
3f1515b
to
609f1a5
Compare
examples/metamask/test/config.ts
Outdated
@@ -0,0 +1,5 @@ | |||
export default { | |||
baseUrl: 'https://www.alphabot.app/', |
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.
what is alphabot
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.
the page user added as an example - this test case is more for you as a prove that this issue has been fixed
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.
@@ -0,0 +1,12 @@ | |||
export function extractWalletSetupFunction(sourceCode: string): string { | |||
const match = sourceCode.match( | |||
/defineWalletSetup\s*\([^,]*,\s*(async\s*\([^)]*\)\s*=>\s*{(?:[^{}]*|{(?:[^{}]*|{[^{}]*})*})*})\s*\)/ |
Check failure
Code scanning / CodeQL
Inefficient regular expression High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 3 months ago
To fix the problem, we need to modify the regular expression to remove the ambiguity and reduce the potential for excessive backtracking. This can be achieved by making the sub-expressions more specific and avoiding patterns that can match the same string in multiple ways. Specifically, we can replace [^{}]*
with a more precise pattern that matches the intended input without allowing for excessive backtracking.
The best way to fix the problem is to rewrite the regular expression to avoid ambiguous sub-expressions and nested quantifiers. We can achieve this by using non-capturing groups and more specific character classes.
-
Copy modified line R3
@@ -2,3 +2,3 @@ | ||
const match = sourceCode.match( | ||
/defineWalletSetup\s*\([^,]*,\s*(async\s*\([^)]*\)\s*=>\s*{(?:[^{}]*|{(?:[^{}]*|{[^{}]*})*})*})\s*\)/ | ||
/defineWalletSetup\s*\([^,]*,\s*(async\s*\([^)]*\)\s*=>\s*{(?:[^{}{}]*|{(?:[^{}{}]*|{[^{}{}]*})*})*})\s*\)/ | ||
) |
@@ -0,0 +1,12 @@ | |||
export function extractWalletSetupFunction(sourceCode: string): string { | |||
const match = sourceCode.match( | |||
/defineWalletSetup\s*\([^,]*,\s*(async\s*\([^)]*\)\s*=>\s*{(?:[^{}]*|{(?:[^{}]*|{[^{}]*})*})*})\s*\)/ |
Check failure
Code scanning / CodeQL
Inefficient regular expression High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 3 months ago
To fix the problem, we need to modify the regular expression to remove the ambiguity that leads to catastrophic backtracking. This can be achieved by making the pattern more specific and less ambiguous. In this case, we can replace the ambiguous [^{}]*
with a more precise pattern that matches the expected structure of the input.
The best way to fix the problem without changing existing functionality is to rewrite the regular expression to avoid nested quantifiers and ambiguous patterns. Specifically, we can use a non-recursive approach to match the nested braces and their contents.
-
Copy modified line R3
@@ -2,3 +2,3 @@ | ||
const match = sourceCode.match( | ||
/defineWalletSetup\s*\([^,]*,\s*(async\s*\([^)]*\)\s*=>\s*{(?:[^{}]*|{(?:[^{}]*|{[^{}]*})*})*})\s*\)/ | ||
/defineWalletSetup\s*\([^,]*,\s*(async\s*\([^)]*\)\s*=>\s*{[^{}]*(?:{[^{}]*}[^{}]*)*})\s*\)/ | ||
) |
No description provided.