Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
fix: disabled drag-and-drop from outside the application
Browse files Browse the repository at this point in the history
Security fix: Thanks to @Suhas-Gaikwad for reporting and helping with this issue
  • Loading branch information
Lasse Kuechler authored and lkuechler committed Feb 1, 2018
1 parent 67db7ca commit cf1fe2f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/component/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,19 @@ MobX.autorun(() => {
});

ReactDom.render(<App store={store} />, document.getElementById('app'));

// Disable drag and drop from outside the application
document.addEventListener(
'dragover',
event => {
event.preventDefault();
},
false
);
document.addEventListener(
'drop',
event => {
event.preventDefault();
},
false
);
16 changes: 16 additions & 0 deletions src/component/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,19 @@ ipcRenderer.on('open-styleguide', (event: {}, message: JsonObject) => {
window.onload = () => {
ReactDom.render(<PreviewApp store={store} />, document.getElementById('app'));
};

// Disable drag and drop from outside the application
document.addEventListener(
'dragover',
event => {
event.preventDefault();
},
false
);
document.addEventListener(
'drop',
event => {
event.preventDefault();
},
false
);

0 comments on commit cf1fe2f

Please sign in to comment.