We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
https://github.com/grevory/bootstrap-file-input/blob/master/bootstrap.file-input.js#L112:
$(this).parent().after('<span class="file-input-name">'+fileName+'</span>');
This opens up users of this library to XSS attacks [1]. fileName should be escaped before it is used inside raw HTML.
fileName
[1] https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)
The text was updated successfully, but these errors were encountered:
I would suggest a fix that uses textContent or jQuery's text() method:
diff --git a/vendor/assets/javascripts/bootstrap-fileinput.js b/vendor/assets/javascripts/bootstrap-fileinput.js index 9467b45..d912909 100644 --- a/vendor/assets/javascripts/bootstrap-fileinput.js +++ b/vendor/assets/javascripts/bootstrap-fileinput.js @@ -103,7 +103,9 @@ $.fn.bootstrapFileInput = function() { fileName = fileName.substring(fileName.lastIndexOf('\\')+1,fileName.length); } - $(this).parent().after('<span class="file-input-name">'+fileName+'</span>'); + var span = jQuery('<span></span>', {"class":"file-input-name"}); + span.text(fileName); + $(this).parent().after(span); }); });
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
https://github.com/grevory/bootstrap-file-input/blob/master/bootstrap.file-input.js#L112:
This opens up users of this library to XSS attacks [1].
fileName
should be escaped before it is used inside raw HTML.[1] https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)
The text was updated successfully, but these errors were encountered: