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 committed Feb 1, 2018
1 parent 303f3bb commit c15b2cf
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 @@ -209,3 +209,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 @@ -50,3 +50,19 @@ ipcRenderer.on('open-styleguide', (event: {}, message: JsonObject) => {
});

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 c15b2cf

Please sign in to comment.