Skip to content

Commit

Permalink
Remove preventdrag script.
Browse files Browse the repository at this point in the history
This was not a security feature; security is enforced using context
isolation and the same-origin policy.

Furthermore, navigation on drag-and-drop was already disabled by
default in Electron 3.0.

https://www.electronjs.org/blog/electron-3-0#breaking-api-changes

Signed-off-by: Anders Kaseorg <[email protected]>
  • Loading branch information
andersk committed Nov 18, 2020
1 parent c8ada3f commit ba432d3
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 24 deletions.
1 change: 0 additions & 1 deletion app/renderer/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@
const version_tag = document.querySelector('#version');
version_tag.textContent = 'v' + app.getVersion();
</script>
<script>require('./js/shared/preventdrag.js')</script>
</body>
</html>
4 changes: 0 additions & 4 deletions app/renderer/js/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ import electron_bridge from './electron-bridge';
import {loadBots} from './notification/helpers';
import * as NetworkError from './pages/network';

// Prevent drag and drop event in main process which prevents remote code executaion
// eslint-disable-next-line import/no-unassigned-import
import './shared/preventdrag';

contextBridge.exposeInMainWorld('raw_electron_bridge', electron_bridge);

electron_bridge.once('zulip-loaded', async () => {
Expand Down
17 changes: 0 additions & 17 deletions app/renderer/js/shared/preventdrag.ts

This file was deleted.

1 change: 0 additions & 1 deletion app/renderer/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,4 @@
// it messes up require module path resolution
require('./js/main');
</script>
<script>require('./js/shared/preventdrag.js')</script>
</html>
1 change: 0 additions & 1 deletion app/renderer/preference.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@
<script>
document.querySelector('#tagify-css').href = require.resolve('@yaireo/tagify/dist/tagify.css');
require('./js/pages/preference/preference.js');
require('./js/shared/preventdrag.js')
</script>
</html>

0 comments on commit ba432d3

Please sign in to comment.