Skip to content

Conversation

imblue-dabadee
Copy link
Contributor

@imblue-dabadee imblue-dabadee commented Aug 29, 2025

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

  • 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

@imblue-dabadee imblue-dabadee requested a review from a team as a code owner August 29, 2025 04:15
@imblue-dabadee imblue-dabadee marked this pull request as draft August 29, 2025 04:15
@imblue-dabadee imblue-dabadee marked this pull request as ready for review August 29, 2025 21:33
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

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 ?

urlPaths: Record<string, Record<string, Record<string, string[]>>>,
) => {
const urlWithProtocol = url.startsWith('http') ? url : `https://${url}`;
const { hostname, pathname } = new URL(urlWithProtocol);
Copy link
Contributor

@AugmentedMode AugmentedMode Sep 15, 2025

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?

@@ -132,6 +136,7 @@ export type PhishingStalelist = {
export type PhishingListState = {
allowlist: string[];
blocklist: string[];
blocklistPaths: Record<string, Record<string, Record<string, string[]>>>;
Copy link
Contributor

@AugmentedMode AugmentedMode Sep 15, 2025

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>;  

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.

Bug: Phishing Detector Ignores C2 Domain Blocklists

Legacy PhishingDetector configurations no longer correctly handle c2DomainBlocklist. The c2DomainBlocklist property is no longer passed to getDefaultPhishingDetectorConfig in the legacy constructor path, causing C2 domain blocklists to be ignored. This is a regression for existing legacy configurations.

packages/phishing-controller/src/PhishingDetector.ts#L76-L92

constructor(opts: PhishingDetectorOptions) {
// recommended configuration
if (Array.isArray(opts)) {
this.#configs = processConfigs(opts);
this.#legacyConfig = false;
// legacy configuration
} else {
this.#configs = [
getDefaultPhishingDetectorConfig({
allowlist: opts.whitelist,
blocklist: opts.blacklist,
fuzzylist: opts.fuzzylist,
tolerance: opts.tolerance,
}),
];
this.#legacyConfig = true;
}

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