From 70f50711bfcf57eb565f84a222889b1a464b9031 Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 25 Feb 2022 16:02:06 +0530 Subject: [PATCH] abort loading several pages if embedded --- www/debug/main.js | 3 +++ www/login/main.js | 1 + www/register/main.js | 1 + 3 files changed, 5 insertions(+) diff --git a/www/debug/main.js b/www/debug/main.js index 6f855e1db..124ea39f9 100644 --- a/www/debug/main.js +++ b/www/debug/main.js @@ -13,6 +13,9 @@ define([ '/common/common-interface.js', ], function (nThen, ApiConfig, $, RequireConfig, SFCommonO, Cryptpad, Util, Hash, Realtime, Constants, UI) { + if (window.top !== window) { + return void window.alert(`If you are seeing this message then somebody might be trying to compromise your CryptPad account. Please contact the CryptPad development team.`); + } window.Cryptpad = { Common: Cryptpad, diff --git a/www/login/main.js b/www/login/main.js index df0be1733..1a27343fc 100644 --- a/www/login/main.js +++ b/www/login/main.js @@ -10,6 +10,7 @@ define([ 'css!/bower_components/components-font-awesome/css/font-awesome.min.css', ], function ($, Cryptpad, Login, UI, Realtime, Feedback, LocalStore /*, Test */) { + if (window.top !== window) { return; } $(function () { var $checkImport = $('#import-recent'); if (LocalStore.isLoggedIn()) { diff --git a/www/register/main.js b/www/register/main.js index 301306f70..8edbaab92 100644 --- a/www/register/main.js +++ b/www/register/main.js @@ -14,6 +14,7 @@ define([ 'css!/bower_components/components-font-awesome/css/font-awesome.min.css', ], function ($, Login, Cryptpad, /*Test,*/ Cred, UI, Util, Realtime, Constants, Feedback, LocalStore, h) { + if (window.top !== window) { return; } var Messages = Cryptpad.Messages; $(function () { if (LocalStore.isLoggedIn()) {