Skip to content
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

feat: add websocket support for c2 detection #29150

Merged
merged 9 commits into from
Dec 12, 2024
12 changes: 3 additions & 9 deletions app/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,9 @@ function maybeDetectPhishing(theController) {
// blocking is better than tab redirection, as blocking will prevent
// the browser from loading the page at all
if (isManifestV2) {
if (details.type === 'sub_frame') {
// redirect the entire tab to the
// phishing warning page instead.
redirectTab(details.tabId, redirectHref);
// don't let the sub_frame load at all
return { cancel: true };
}
// redirect the whole tab
return { redirectUrl: redirectHref };
// redirect the whole tab (even if it's a sub_frame request)
redirectTab(details.tabId, redirectHref);
return { cancel: true };
davidmurdoch marked this conversation as resolved.
Show resolved Hide resolved
}
// redirect the whole tab (even if it's a sub_frame request)
redirectTab(details.tabId, redirectHref);
Expand Down
14 changes: 6 additions & 8 deletions test/e2e/tests/phishing-controller/phishing-detection.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,9 @@ describe('Phishing Detection', function () {
text: 'Back to safety',
});

const currentUrl = await driver.getCurrentUrl();
const expectedPortfolioUrl = `https://portfolio.metamask.io/?metamaskEntry=phishing_page_portfolio_button`;

assert.equal(currentUrl, expectedPortfolioUrl);
await driver.waitForUrl({
url: `https://portfolio.metamask.io/?metamaskEntry=phishing_page_portfolio_button`,
});
davidmurdoch marked this conversation as resolved.
Show resolved Hide resolved
},
);
});
Expand Down Expand Up @@ -350,10 +349,9 @@ describe('Phishing Detection', function () {
text: 'Back to safety',
});

const currentUrl = await driver.getCurrentUrl();
const expectedPortfolioUrl = `https://portfolio.metamask.io/?metamaskEntry=phishing_page_portfolio_button`;

assert.equal(currentUrl, expectedPortfolioUrl);
await driver.waitForUrl({
url: `https://portfolio.metamask.io/?metamaskEntry=phishing_page_portfolio_button`,
});
},
);
});
Expand Down
Loading