Skip to content

Commit b354458

Browse files
committed
Fixed potential catastrophic backtracking vulnerability
1 parent aa072f8 commit b354458

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed

gulp-cssimport.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ function isMatch(path, options) {
240240
var fileExt = getExtension(path);
241241
for (var k = 0; k < extensions.length; k++) {
242242
var extension = extensions[k];
243-
var isInverse = extension.charAt(0) === "!";
243+
var isInverse = extension.charAt(0) === '!';
244244
if (isInverse) {
245245
extension = extension.slice(1);
246246
}
@@ -251,18 +251,17 @@ function isMatch(path, options) {
251251
}
252252
}
253253
}
254-
if (typeof result === "undefined") {
254+
if (typeof result === 'undefined') {
255255
result = true;
256256
}
257257
return result;
258258
}
259259

260260
function isUrl(s) {
261-
var regexp = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-/]))?/;
262-
return regexp.test(s);
261+
return /^(http|https):\/\//.test(s);
263262
}
264263

265264
function getExtension(p) {
266265
p = String(p);
267-
return p.substr(p.lastIndexOf(".") + 1);
266+
return p.substr(p.lastIndexOf('.') + 1);
268267
}

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "Parses a CSS file, finds imports, grabs the content of the linked file and replaces the import statement with it.",
55
"main": "gulp-cssimport.js",
66
"scripts": {
7+
"np": "np",
78
"test": "cd test && node index.js"
89
},
910
"repository": {
@@ -31,11 +32,11 @@
3132
},
3233
"devDependencies": {
3334
"gulp": "3",
34-
"gulp-bump": "2.7.0",
35-
"gulp-eslint": "^4.0.0",
36-
"gulp-load-plugins": "1.5.0",
35+
"gulp-bump": "^3.1.0",
36+
"gulp-eslint": "^4.0.2",
37+
"gulp-load-plugins": "^1.5.0",
3738
"gulp-sourcemaps": "*",
38-
"tape": "^4.8.0"
39+
"tape": "^4.9.0"
3940
},
4041
"license": "MIT"
4142
}

readme.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,40 +136,43 @@ TODO
136136

137137
CHANGELOG
138138
---------
139-
6.0 [1 Sep 2017]
139+
6.0.1 [23 Feb 2018]
140+
- fixed potential catastrophic backtracking vulnerability
141+
142+
6.0.0 [01 Sep 2017]
140143
- remove byte order mask from imported files
141144

142-
5.1 [13 Aug 2017]
145+
5.1.0 [13 Aug 2017]
143146
- added option 'transform'
144147

145-
5.0 [20 Nov 2016]
148+
5.0.0 [20 Nov 2016]
146149
- added option 'skipComments'
147150

148-
4.0 [6 Oct 2016]
151+
4.0.0 [06 Oct 2016]
149152
- added option 'includePaths'
150153

151-
3.0 [28 Feb 2016]
154+
3.0.0 [28 Feb 2016]
152155
- removed node streams support, now only gulp
153156
- removed directory option
154157
- added sourcemaps support
155158
- fixed bogus destination bugs
156159

157-
2.0 [30 Jun 2015]
160+
2.0.0 [30 Jun 2015]
158161
- changed parse algorithm
159162
- can handle recursive import
160163
- can handle minified css files
161164
- added option 'matchPattern'
162165

163-
1.3 [14 Nov 2014]
166+
1.3.0 [14 Nov 2014]
164167
- added option 'extensions'
165168
- added option 'filter'
166169

167-
1.2 [15 Feb 2014]
170+
1.2.0 [15 Feb 2014]
168171
- fixed processing urls
169172

170-
1.1 [15 Feb 2014]
173+
1.1.0 [15 Feb 2014]
171174
- switched to through2
172175
- process files asynchronously
173176

174-
1.0 [12 Feb 2014]
177+
1.0.0 [12 Feb 2014]
175178
- first release

0 commit comments

Comments
 (0)