Skip to content

Master#1722

Closed
drqsatoshi wants to merge 6 commits intoMetaMask:masterfrom
drqsatoshi:master
Closed

Master#1722
drqsatoshi wants to merge 6 commits intoMetaMask:masterfrom
drqsatoshi:master

Conversation

@drqsatoshi
Copy link

@drqsatoshi drqsatoshi commented Feb 15, 2026

Help the poor disabled man out aka me


Note

Medium Risk
Introduces a new filesystem- and network-touching CLI (writes metadata/icons and can download remote files), which could affect repo contents if misused; changes are largely additive and covered by new tests.

Overview
Adds a new cli-update-asset.js tool to create/update CAIP-19 asset metadata, download/copy icons, verify metadata/icon integrity (including permitted-field checks, symbol length, icon existence/format, and optional EIP-55 checksum validation), and list assets by chain.

Updates package.json to expose asset:* scripts and run a new test/cli-update-asset.js suite (plus test:cli) covering CLI argument handling, update/verify/list behaviors, and CAIP-19 ID validation. Also introduces AI assistant guidance files (CLAUDE.md, .cursorrules, and Copilot instructions) documenting repo conventions and the new CLI workflow.

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

@drqsatoshi drqsatoshi requested review from a team and MRabenda as code owners February 15, 2026 06:56
Copy link

@cursor cursor bot left a comment

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 2 potential issues.

function detectExtension(urlOrPath) {
const lower = urlOrPath.toLowerCase();
if (lower.endsWith(".svg") || lower.includes("svg")) return "svg";
if (lower.endsWith(".png") || lower.includes("png")) return "png";
Copy link

Choose a reason for hiding this comment

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

Extension detection matches "svg"/"png" anywhere in URL path

High Severity

detectExtension uses lower.includes("svg") and lower.includes("png") which match substrings anywhere in the URL or file path — domain names, directory names, query parameters. Because the SVG includes check runs first, any URL or path containing "svg" anywhere (e.g. https://svg-host.com/token.png or /svg-icons/token.png) will incorrectly return "svg", even when the actual file extension is .png. This causes icons to be saved with the wrong extension and metadata logo to reference the wrong filename.

Fix in Cursor Fix in Web

.get(url, (res) => {
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
// Follow redirect
return downloadFile(res.headers.location, dest).then(resolve, reject);
Copy link

Choose a reason for hiding this comment

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

Unconsumed redirect response causes CLI process to hang

Medium Severity

When downloadFile encounters an HTTP redirect, it recursively follows the location header but never consumes the redirect response body (no res.resume() or res.destroy()). In Node.js, an unconsumed response keeps its underlying TCP socket alive in the event loop. Since main() doesn't call process.exit(0) on success, the CLI process will hang indefinitely after any icon download that involves a redirect — a very common scenario with CDN URLs.

Additional Locations (1)

Fix in Cursor Fix in Web

@drqsatoshi
Copy link
Author

Continuing from pr #1715 and pr #1712

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