Skip to content

Conversation

@Dargon789
Copy link
Owner

@Dargon789 Dargon789 commented Sep 29, 2025

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 like interface.gateway.uniswap.org or beta.gateway.uniswap.org. The intended match is specific subdomains leading to the gateway of uniswap.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 file apps/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:

  • Escape the dots in the gateway.uniswap.org regex to ensure literal period matching and prevent unintended host matches

…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>
@codesandbox
Copy link

codesandbox bot commented Sep 29, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@vercel
Copy link

vercel bot commented Sep 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
interface-extension Error Error Sep 29, 2025 7:39pm

@sourcery-ai
Copy link

sourcery-ai bot commented Sep 29, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Tighten 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 test

sequenceDiagram
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
Loading

Class diagram for updated test route interception

classDiagram
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) => {...})
Loading

File-Level Changes

Change Details Files
Escape periods in host regex to enforce literal matches
  • Replaced each unescaped . with \. in the hostname portion of the regex
  • Updated the Playwright route stub to use the escaped-regex for /v1/amplitude-proxy
apps/web/src/pages/Landing/Landing.e2e.test.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@Dargon789 Dargon789 self-assigned this Sep 29, 2025
@snyk-io
Copy link

snyk-io bot commented Sep 29, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

@cloudflare-workers-and-pages
Copy link

Deploying uniswap with  Cloudflare Pages  Cloudflare Pages

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

View logs

@vercel vercel bot temporarily deployed to Preview – interface-extension September 29, 2025 19:39 Inactive
@Dargon789 Dargon789 marked this pull request as ready for review September 29, 2025 19:40
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Dargon789 Dargon789 merged commit 607e2db into main Sep 29, 2025
17 of 20 checks passed
@Dargon789 Dargon789 deleted the alert-autofix-19 branch September 29, 2025 19:43
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.

2 participants