-
Notifications
You must be signed in to change notification settings - Fork 0
Potential fix for code scanning alert no. 19: Incomplete regular expression for hostnames #63
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
Conversation
…ession for hostnames Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Reviewer's guide (collapsed on small PRs)Reviewer's GuideTighten the test’s route-intercept regex by escaping dots in the host pattern so it only matches the intended subdomains of gateway.uniswap.org, fixing an overbroad regex vulnerability. Sequence diagram for stricter route interception in testsequenceDiagram
participant Test as "Landing.e2e.test.ts"
participant Page
participant Route
Test->>Page: page.route(/(?:interface|beta)\.gateway\.uniswap\.org\/v1\/amplitude-proxy/, ...)
Page->>Route: Intercept request matching stricter regex
Route->>Route: request().postDataJSON()
Route->>Route: fetch()
Route->>Route: new Blob([requestBody]).size
Class diagram for updated test route interceptionclassDiagram
class "Landing.e2e.test.ts" {
+test('renders UK compliance banner in UK')
}
"Landing.e2e.test.ts" : +page.route(/(?:interface|beta)\.gateway\.uniswap\.org\/v1\/amplitude-proxy/, async (route) => {...})
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) |
Deploying uniswap with
|
| Latest commit: |
df69e47
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://94edb348.uniswap-omj.pages.dev |
| Branch Preview URL: | https://alert-autofix-19.uniswap-omj.pages.dev |
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.
Potential fix for https://github.com/Dargon789/interface/security/code-scanning/19
To fix the problem, the periods (
.) in the host part of the regular expression should be escaped with\.so that each matches a literal period rather than any character. In the given snippet, the regular expression/(?:interface|beta).gateway.uniswap.org\/v1\/amplitude-proxy/is used to intercept requests to domains likeinterface.gateway.uniswap.orgorbeta.gateway.uniswap.org. The intended match is specific subdomains leading to the gateway ofuniswap.org, so escaping all the periods is the best way to ensure only these hosts are matched.The fix is simple: replace every
.in the host part (before.org) with\.so the regex becomes/^(?:interface|beta)\.gateway\.uniswap\.org\/v1\/amplitude-proxy/(using^makes the match stricter, but is optional). Make this change only on line 56 in the fileapps/web/src/pages/Landing/Landing.e2e.test.ts.No additional imports are needed.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.
Summary by Sourcery
Bug Fixes: