mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 02:10:12 +01:00
7199d9c567
An externally hosted phishing warning page is now used rather than the built-in phishing warning page.The phishing page warning URL is set via configuration file or environment variable. The default URL is either the expected production URL or `http://localhost:9999/` for e2e testing environments. The new external phishing page includes a design change when it is loaded within an iframe. In that case it now shows a condensed message, and prompts the user to open the full warning page in a new tab to see more details or bypass the warning. This is to prevent a clickjacking attack from safelisting a site without user consent. The new external phishing page also includes a simple caching service worker to ensure it continues to work offline (or if our hosting goes offline), as long as the user has successfully loaded the page at least once. We also load the page temporarily during the extension startup process to trigger the service worker installation. The old phishing page and all related lines have been removed. The property `web_accessible_resources` has also been removed from the manifest. The only entry apart from the phishing page was `inpage.js`, and we don't need that to be web accessible anymore because we inject the script inline into each page rather than loading the file directly. New e2e tests have been added to cover more phishing warning page functionality, including the "safelist" action and the "iframe" case.
19 lines
480 B
HTML
19 lines
480 B
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<title>Mock E2E Phishing Page</title>
|
|
</head>
|
|
<script type="text/javascript">
|
|
function setIframeSource() {
|
|
const urlSearchParams = new URLSearchParams(window.location.search);
|
|
const params = Object.fromEntries(urlSearchParams.entries());
|
|
document.getElementById('frame').src = params.extensionUrl;
|
|
}
|
|
window.onload = setIframeSource;
|
|
</script>
|
|
<body>
|
|
<div>Hello</div>
|
|
<iframe id="frame" width=900 height=900>
|
|
</body>
|
|
|
|
</html> |