Skip to content

Commit

Permalink
fix(TextBox): prevent insertion of HTML
Browse files Browse the repository at this point in the history
This prevents the evaluation of arbitrary JavaScript when pasting HTML
code into the edit box such as

```javascript
<video src=1 onerror=alert('hueh')>
```

Related to bpmn-io/bpmn-js#1073
  • Loading branch information
nikku authored and merge-me[bot] committed Jun 12, 2019
1 parent c0bbe85 commit 122cb92
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/TextBox.js
Expand Up @@ -202,8 +202,8 @@ TextBox.prototype.handlePaste = function(e) {
text = window.clipboardData.getData('Text');
}

// insertHTML command not supported by Internet Explorer
var success = document.execCommand('insertHTML', false, text);
// insertText command not supported by Internet Explorer
var success = document.execCommand('insertText', false, text);

if (!success) {

Expand Down

0 comments on commit 122cb92

Please sign in to comment.