-
-
Notifications
You must be signed in to change notification settings - Fork 249
feat: check against urls with path #6416
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
base: main
Are you sure you want to change the base?
Conversation
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.
We shouldn't be modifying this file should we ?
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.
Hey there! This file gets automatically updated when you run yarn lint
, it's okay to modify and commit this. The goal of this file is to track how many lint warnings there are so we can slowly remove them (it's a tech debt kind of thing). Only thing I would say is that the numbers in this file should go down.
urlPaths: Record<string, Record<string, Record<string, string[]>>>, | ||
) => { | ||
const urlWithProtocol = url.startsWith('http') ? url : `https://${url}`; | ||
const { hostname, pathname } = new URL(urlWithProtocol); |
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.
new URL()
throws on bad input. Should we wrap this with a try/catch?
export type PhishingListState = { | ||
allowlist: string[]; | ||
blocklist: string[]; | ||
blocklistPaths: Record<string, Record<string, Record<string, string[]>>>; |
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.
What do you think about a type like this instead for better readability
type PathBlockNode = {
isBlocked: boolean;
blockAllSubpaths: boolean;
children: Record<string, PathBlockNode>;
};
type BlocklistPaths = Record<string, PathBlockNode>;
- We can assume that whenever config is given to this function, that separateBlocklistEntries has already been called so this would be unnecessary to do.
Explanation
There has been an advent of sites such as
sites.google.com
being used maliciously that bypass the checks as they contain an allowlisted hostname. This PR aims to enable the Phishing Controller to block URL paths so that we can maintain the same allowlist but also block malicious websites that use allowlisted hostnames.References
Checklist