Skip to content

Conversation

@AugmentedMode
Copy link
Contributor

@AugmentedMode AugmentedMode commented Nov 11, 2025

Explanation

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

Note

Introduces address scanning via SECURITY_ALERTS API with cache-backed scanAddress action, new state/options, and supporting types.

  • Controller (packages/phishing-controller/src/PhishingController.ts):
    • Add scanAddress(chainId, address) integrating ${SECURITY_ALERTS_BASE_URL}${ADDRESS_SCAN_ENDPOINT} with 5s timeout, error handling, and caching.
    • Introduce addressScanCache state, DEFAULT_ADDRESS_SCAN_CACHE_TTL/MAX_SIZE, and configurable addressScanCacheTTL/addressScanCacheMaxSize options.
    • Initialize #addressScanCache: CacheManager<AddressScanCacheData> and persist to state/metadata.
    • Register new messenger action handler PhishingController:scanAddress and export corresponding action type.
    • Add constant ADDRESS_SCAN_ENDPOINT = '/address/evm/scan'.
  • Types (packages/phishing-controller/src/types.ts):
    • Add AddressScanResultType, AddressScanResult, AddressScanCacheData, and AddressScanApiResponse.
    • Export chain-to-name map unchanged but referenced by address scan logic.

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

@AugmentedMode AugmentedMode requested a review from a team as a code owner November 11, 2025 15:46
};
}

const normalizedChainId = chainId.toLowerCase();
Copy link

Choose a reason for hiding this comment

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

Bug: Missing Validation Triggers Runtime Failures.

The scanAddress function validates address but not chainId before calling chainId.toLowerCase(). If chainId is undefined or null, the function crashes with a runtime error instead of returning a proper error response with AddressScanResultType.ErrorResult.

Fix in Cursor Fix in Web

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