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

Commit

Permalink
Check Content-Type header before parsing AJAX response as HTML (#8649)
Browse files Browse the repository at this point in the history
Fix for issue #8640 (possible XSS vulnerability)
  • Loading branch information
dryabov authored and apsdehal committed Jun 13, 2019
1 parent 1f0cec9 commit b0d9cc7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions js/widgets/pagecontainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,15 @@ $.widget( "mobile.pagecontainer", {

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

// Check that Content-Type is "text/html" (https://github.com/jquery/jquery-mobile/issues/8640)
if ( !/^text\/html\b/.test( xhr.getResponseHeader('Content-Type') ) ) {
// Display error message for unsupported content type
if ( settings.showLoadMsg ) {
this._showError();
}
return;
}

// Pre-parse html to check for a data-url, use it as the new fileUrl, base path, etc
var content,

Expand Down

0 comments on commit b0d9cc7

Please sign in to comment.