-
-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[phishing-controller] Add PhishingDetector
from eth-phishing-detector
#4137
Conversation
New dependencies detected. Learn more about Socket for GitHub ↗︎
|
Main files from |
d86fbb5
to
a2ee244
Compare
#configs: PhishingDetectorConfiguration[]; | ||
|
||
#legacyConfig: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two were originally public in eth-phishing-detector
, but looks like they are not used outside of this class - we should be able to prepend # to these without issues
export type PhishingDetectorConfiguration = { | ||
name?: string; | ||
version?: number | string; | ||
allowlist: string[][]; | ||
blocklist: string[][]; | ||
fuzzylist: string[][]; | ||
tolerance: number; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be confusing, but the main difference between the options passed to the constructor, and the configs saved in #configs
(PhishingDetectorConfiguration
) is that domains are divided in parts, so each list becomes a matrix
return result; | ||
} | ||
|
||
#check(domain: string): PhishingDetectorResult { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can most likely be merged into the public check
method since all the public method does is handle the differences with the legacy result type, so that we don't have two methods with the same name without a clear responsibility distinction.
I'm unsure about doing it in this PR though, since there are many things to review already
@mikesposito Is the plan to eventually remove the relevant code from https://github.com/MetaMask/eth-phishing-detect/blob/main/src/detector.js and centralize everything here instead? |
@NicholasEllul exactly! the plan is to leave the |
a2ee244
to
e9f7052
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! A lot of comments here, but most are minor. Only major comments are some questions about the logic in check
.
Co-authored-by: Elliot Winkler <[email protected]>
Co-authored-by: Elliot Winkler <[email protected]>
Co-authored-by: Elliot Winkler <[email protected]>
163b6cd
to
38807df
Compare
bf8fe91
to
dda4d9e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Explanation
This PR adds the
PhishingDetector
class frometh-phising-detector
, along with some utility functions into the@metamask/phishing-controller
package, converting all to Typescript and Jest.References
Changelog
@metamask/phishing-detector
PhishingDetector
frometh-phising-detector
Checklist