Skip to content

Commit

Permalink
Fix root cause of XSS in autolinker plugin #1054
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob--W committed Nov 9, 2016
1 parent 716bb85 commit d8c6062
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/prism-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ Token.stringify = function(o, language, parent) {
_.hooks.run('wrap', env);

var attributes = Object.keys(env.attributes).map(function(name) {
return name + '="' + (env.attributes[name] || '') + '"';
return name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"';
}).join(' ');

return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + '</' + env.tag + '>';
Expand Down
2 changes: 1 addition & 1 deletion components/prism-core.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion prism.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ Token.stringify = function(o, language, parent) {
_.hooks.run('wrap', env);

var attributes = Object.keys(env.attributes).map(function(name) {
return name + '="' + (env.attributes[name] || '') + '"';
return name + '="' + (env.attributes[name] || '').replace(/"/g, '&quot;') + '"';
}).join(' ');

return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + '</' + env.tag + '>';
Expand Down

0 comments on commit d8c6062

Please sign in to comment.