Commit b40b3b47 authored by Kevin Adams's avatar Kevin Adams

fixed XSS vuln in searchbox

parent 9c7ea333
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
}); });
highlight.call(this); highlight.call(this);
} else { } else {
searchResults.html('<li>No Results Found for "' + this.value + '"</li>'); searchResults.html('<li>No Results Found for "' + this.value.escapeHTML() + '"</li>');
} }
} else { } else {
unhighlight(); unhighlight();
...@@ -69,4 +69,19 @@ ...@@ -69,4 +69,19 @@
content.unhighlight(highlightOpts); content.unhighlight(highlightOpts);
} }
var __entityMap = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': '&quot;',
"'": '&#39;',
"/": '&#x2F;'
};
String.prototype.escapeHTML = function() {
return String(this).replace(/[&<>"'\/]/g, function (s) {
return __entityMap[s];
});
}
})(window); })(window);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment