Skip to content

Commit af543e2

Browse files
committed
🔒️ fix CVE-2015-9251
1 parent 2888cae commit af543e2

File tree

7 files changed

+71
-9
lines changed

7 files changed

+71
-9
lines changed

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[submodule "src/sizzle"]
22
path = src/sizzle
3-
url = git://github.com/jquery/sizzle.git
3+
url = https://github.com/jquery/sizzle.git
44
[submodule "test/qunit"]
55
path = test/qunit
6-
url = git://github.com/jquery/qunit.git
6+
url = https://github.com/qunitjs/qunit.git

build/jslint-check.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var e = JSLINT.errors, found = 0, w;
2121
for ( var i = 0; i < e.length; i++ ) {
2222
w = e[i];
2323

24-
if ( !ok[ w.reason ] ) {
24+
if ( w && !ok[ w.reason ] ) {
2525
found++;
2626
print( "\n" + w.evidence + "\n" );
2727
print( " Problem at line " + w.line + " character " + w.character + ": " + w.reason );

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name" : "jquery",
3-
"version" : "1.6.4",
3+
"version" : "1.6.5-sec",
44
"main" : "./jquery.js",
55
"dependencies": {
66
}

jquery.js

100755100644
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* jQuery JavaScript Library v1.6.4
2+
* jQuery JavaScript Library v1.6.5-sec
33
* http://jquery.com/
44
*
55
* Copyright 2011, John Resig
@@ -11,7 +11,7 @@
1111
* Copyright 2011, The Dojo Foundation
1212
* Released under the MIT, BSD, and GPL Licenses.
1313
*
14-
* Date: Mon Sep 12 18:54:48 2011 -0400
14+
* Date: Wed Feb 12 09:58:38 2014 -0800
1515
*/
1616
(function( window, undefined ) {
1717

@@ -213,7 +213,7 @@ jQuery.fn = jQuery.prototype = {
213213
selector: "",
214214

215215
// The current version of jQuery being used
216-
jquery: "1.6.4",
216+
jquery: "1.6.5-sec",
217217

218218
// The default length of a jQuery object is 0
219219
length: 0,
@@ -7756,6 +7756,13 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
77567756

77577757

77587758

7759+
// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
7760+
jQuery.ajaxPrefilter( function( s ) {
7761+
if ( s.crossDomain ) {
7762+
s.contents.script = false;
7763+
}
7764+
} );
7765+
77597766
// Install script dataType
77607767
jQuery.ajaxSetup({
77617768
accepts: {
@@ -9043,4 +9050,4 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
90439050

90449051
// Expose jQuery to the global object
90459052
window.jQuery = window.$ = jQuery;
9046-
})(window);
9053+
})(window);

src/ajax/script.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
(function( jQuery ) {
22

3+
// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
4+
jQuery.ajaxPrefilter( function( s ) {
5+
if ( s.crossDomain ) {
6+
s.contents.script = false;
7+
}
8+
} );
9+
310
// Install script dataType
411
jQuery.ajaxSetup({
512
accepts: {

test/unit/ajax.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,54 @@ test("jQuery.ajax() - success callbacks - (url, options) syntax", function() {
7070
}, 13);
7171
});
7272

73+
ajaxTest( "jQuery.ajax() - do not execute js (crossOrigin)", 2, function( assert ) {
74+
return {
75+
create: function( options ) {
76+
options.crossDomain = true;
77+
return jQuery.ajax( url( "data/script.php?header=ecma" ), options );
78+
},
79+
success: function() {
80+
assert.ok( true, "success" );
81+
},
82+
complete: function() {
83+
assert.ok( true, "complete" );
84+
}
85+
};
86+
} );
87+
88+
ajaxTest( "jQuery.ajax() - execute js for crossOrigin when dataType option is provided", 3,
89+
function( assert ) {
90+
return {
91+
create: function( options ) {
92+
options.crossDomain = true;
93+
options.dataType = "script";
94+
return jQuery.ajax( url( "data/script.php?header=ecma" ), options );
95+
},
96+
success: function() {
97+
assert.ok( true, "success" );
98+
},
99+
complete: function() {
100+
assert.ok( true, "complete" );
101+
}
102+
};
103+
}
104+
);
105+
106+
ajaxTest( "jQuery.ajax() - do not execute js (crossOrigin)", 2, function( assert ) {
107+
return {
108+
create: function( options ) {
109+
options.crossDomain = true;
110+
return jQuery.ajax( url( "data/script.php" ), options );
111+
},
112+
success: function() {
113+
assert.ok( true, "success" );
114+
},
115+
complete: function() {
116+
assert.ok( true, "complete" );
117+
}
118+
};
119+
} );
120+
73121
test("jQuery.ajax() - success callbacks (late binding)", function() {
74122
expect( 8 );
75123

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.6.4
1+
1.6.5-sec

0 commit comments

Comments
 (0)