Skip to content

chore: add get-starknet proxying for dapp testing - #569

Open
khanti42 wants to merge 2 commits into
mainfrom
chore/get-starknet-proxy-for-tests
Open

chore: add get-starknet proxying for dapp testing#569
khanti42 wants to merge 2 commits into
mainfrom
chore/get-starknet-proxy-for-tests

Conversation

@khanti42

@khanti42 khanti42 commented Jan 26, 2026

Copy link
Copy Markdown
Collaborator

Note

Medium Risk
Primarily dev tooling, but it introduces proxy scripts that can intercept HTTPS traffic and changes webpack-dev-server host validation (allowedHosts: 'all'), which could be misused if run in unsafe environments.

Overview
Adds a mitmproxy-based workflow for testing local get-starknet changes against external dapps by redirecting production CDN requests (snaps.consensys.io/starknet/get-starknet/v1/*) to either localhost:8082 or dev.snaps.consensys.io via GET_STARKNET_PROXY_TARGET.

Includes new yarn proxy:* scripts, macOS helper scripts to enable/disable system proxy, and updates the local webpack dev server to allow all hosts for proxying and to ensure CORS headers are present.

Written by Cursor Bugbot for commit 6049cec. This will update automatically on new commits. Configure here.

@khanti42
khanti42 requested review from a team as code owners January 26, 2026 08:14

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

set -e

PROXY_HOST="127.0.0.1"
PROXY_PORT="8088"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Wrong proxy port causes setup to fail

High Severity

The PROXY_PORT is set to "8088" but mitmproxy's default port is 8888. The comment on line 3 and the README both correctly reference port 8888. This typo causes the system proxy to be configured on the wrong port, so traffic will not route through mitmproxy, making the entire proxy setup non-functional.

Fix in Cursor Fix in Web

Intercept HTTP requests and redirect get-starknet requests based on configuration.
"""
# Only handle get-starknet requests
if PRODUCTION_HOST in flow.request.pretty_host and "/starknet/get-starknet/v1/" in flow.request.path:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Proxy intercepts dev server requests due to substring match

Medium Severity

The host check uses PRODUCTION_HOST in flow.request.pretty_host with substring matching. Since PRODUCTION_HOST is "snaps.consensys.io" and DEV_HOST is "dev.snaps.consensys.io", the condition matches both hosts. In "local" mode, requests to the dev server will be incorrectly redirected to localhost, causing unexpected failures when developers use both environments simultaneously.

Fix in Cursor Fix in Web

flow.response.headers["Access-Control-Allow-Origin"] = "*"
flow.response.headers["Access-Control-Allow-Methods"] = "GET, POST, PUT, DELETE, PATCH, OPTIONS"
flow.response.headers["Access-Control-Allow-Headers"] = "X-Requested-With, content-type, Authorization"
flow.response.headers["Access-Control-Allow-Credentials"] = "true"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Invalid CORS headers combination breaks credentialed requests

Low Severity

Setting Access-Control-Allow-Origin: * together with Access-Control-Allow-Credentials: true is invalid per the CORS specification. Browsers will reject responses with this combination when the request includes credentials (cookies, auth headers). This can cause confusing CORS errors that seem unrelated to credentials.

Fix in Cursor Fix in Web

@sonarqubecloud

sonarqubecloud Bot commented Feb 3, 2026

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed for 'consensys_starknet-snap-wallet-ui'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@sonarqubecloud

sonarqubecloud Bot commented Feb 3, 2026

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed for 'consensys_starknet-snap-starknet-snap'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

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.

1 participant