Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit b0d9cc7

Browse files
dryabovapsdehal
authored andcommitted
Check Content-Type header before parsing AJAX response as HTML (#8649)
Fix for issue #8640 (possible XSS vulnerability)
1 parent 1f0cec9 commit b0d9cc7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

js/widgets/pagecontainer.js

+9
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,15 @@ $.widget( "mobile.pagecontainer", {
564564

565565
return $.proxy( function( html, textStatus, xhr ) {
566566

567+
// Check that Content-Type is "text/html" (https://github.com/jquery/jquery-mobile/issues/8640)
568+
if ( !/^text\/html\b/.test( xhr.getResponseHeader('Content-Type') ) ) {
569+
// Display error message for unsupported content type
570+
if ( settings.showLoadMsg ) {
571+
this._showError();
572+
}
573+
return;
574+
}
575+
567576
// Pre-parse html to check for a data-url, use it as the new fileUrl, base path, etc
568577
var content,
569578

0 commit comments

Comments
 (0)