feat: add address poisoning detection to PhishingController#8171
Open
AugmentedMode wants to merge 12 commits intomainfrom
Open
feat: add address poisoning detection to PhishingController#8171AugmentedMode wants to merge 12 commits intomainfrom
AugmentedMode wants to merge 12 commits intomainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
This PR adds address poisoning detection to
@metamask/phishing-controllerby:findSimilarAddressesutility that compares a candidate address against known recipients using prefix/suffix matching heuristicsPhishingController:checkAddressPoisoningmessenger action that clients can call to check if a recipient address looks like a poisoning attemptTransactionControllerstateAddressBookControllerstateReferences
Checklist
Note
Medium Risk
Adds new public messenger action and background state hydration/subscriptions to
TransactionControllerandAddressBookController, which could affect runtime behavior and performance if recipient tracking or matching is incorrect. Logic is additive and guarded, but touches controller wiring and event handling.Overview
Adds address-poisoning detection to
@metamask/phishing-controllerby introducingfindSimilarAddressesand a newPhishingController:checkAddressPoisoningaction that returns similarity metadata (prefix/suffix lengths, score, diff indices).PhishingControllernow hydrates and maintains an in-memory set of known recipient addresses sourced from confirmed transactions and address-book entries, updating this set on both controllers’stateChangeevents (with error isolation so token scanning still proceeds). Tests and types/exports are updated accordingly, and@metamask/address-book-controlleris added as a dependency.Written by Cursor Bugbot for commit c210787. This will update automatically on new commits. Configure here.