mirror of
https://github.com/danbulant/api_docs
synced 2026-05-19 04:08:40 +00:00
fixed XSS vuln in searchbox
This commit is contained in:
parent
9c7ea33305
commit
b40b3b47ed
1 changed files with 16 additions and 1 deletions
|
|
@ -53,7 +53,7 @@
|
|||
});
|
||||
highlight.call(this);
|
||||
} else {
|
||||
searchResults.html('<li>No Results Found for "' + this.value + '"</li>');
|
||||
searchResults.html('<li>No Results Found for "' + this.value.escapeHTML() + '"</li>');
|
||||
}
|
||||
} else {
|
||||
unhighlight();
|
||||
|
|
@ -69,4 +69,19 @@
|
|||
content.unhighlight(highlightOpts);
|
||||
}
|
||||
|
||||
var __entityMap = {
|
||||
"&": "&",
|
||||
"<": "<",
|
||||
">": ">",
|
||||
'"': '"',
|
||||
"'": ''',
|
||||
"/": '/'
|
||||
};
|
||||
|
||||
String.prototype.escapeHTML = function() {
|
||||
return String(this).replace(/[&<>"'\/]/g, function (s) {
|
||||
return __entityMap[s];
|
||||
});
|
||||
}
|
||||
|
||||
})(window);
|
||||
|
|
|
|||
Loading…
Reference in a new issue