Skip to content

Commit

Permalink
Backport ReDoS vulnerabilities from PostCSS 8
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Jun 11, 2021
1 parent 12832f3 commit 54cbf3c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/previous-map.es6
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ class PreviousMap {

getAnnotationURL (sourceMapString) {
return sourceMapString
.match(/\/\*\s*# sourceMappingURL=(.*)\s*\*\//)[1]
.match(/\/\*\s*# sourceMappingURL=((?:(?!sourceMappingURL=).)*)\*\//)[1]
.trim()
}

loadAnnotation (css) {
let annotations = css.match(/\/\*\s*# sourceMappingURL=(.*)\s*\*\//mg)
let annotations = css.match(
/\/\*\s*# sourceMappingURL=(?:(?!sourceMappingURL=).)*\*\//gm
)

if (annotations && annotations.length > 0) {
// Locate the last sourceMappingURL to avoid picking up
Expand Down

0 comments on commit 54cbf3c

Please sign in to comment.