Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code scanning alert issue-#1345 #1549

Merged
merged 2 commits into from
Nov 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion website/static/vendor/bootstrap/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -2028,7 +2028,7 @@ function sanitizeInput(input) {
'[data-target="' + target + '"],' +
this.selector + '[href="' + target + '"]'

var active = $(selector)
var active = $(escapePotentialXSS(selector))
.parents('li')
.addClass('active')

Expand Down Expand Up @@ -2407,3 +2407,20 @@ function sanitizeInput(input) {
})

}(jQuery);
function escapePotentialXSS(selector) {
// Escaping only the specific characters that can lead to XSS
// such as <, >, ", ', and ` which are not valid in CSS selectors
// and can be used for XSS if injected into HTML content.
return selector.replace(/[<>\"'`]/g, function(match) {
// Convert potentially dangerous characters to their
// corresponding HTML entity representations.
switch(match) {
case '<': return '&lt;';
case '>': return '&gt;';
case '"': return '&quot;';
case '\'': return '&#39;';
case '`': return '&#96;';
default: return match;
}
});
}
Loading