Skip to content

Commit

Permalink
Potentiel security bug corrected
Browse files Browse the repository at this point in the history
Bug reproduction: 1) paste texte containing html/javascript. 2) send 3)
clic "Raw text"  4) refresh: The html/javascript is interpreted instead
of just displayed.
Under some versions of Chrome, it happens without refreshing.
This bug was corrected.
  • Loading branch information
sebsauvage committed Jan 20, 2014
1 parent 43fa904 commit 4f8750b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions js/zerobin.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,9 @@ function stateExistingPaste() {
*/
function rawText()
{
history.pushState(document.title, document.title, 'document.txt');
var paste = $('div#cleartext').text();
var newDoc = document.open('text/plain', 'replace');
newDoc.write(paste);
var paste = $('div#cleartext').html();
var newDoc = document.open('text/html', 'replace');
newDoc.write('<pre>'+paste+'</pre>');
newDoc.close();
}

Expand Down

0 comments on commit 4f8750b

Please sign in to comment.