Skip to content

Commit d2d752d

Browse files
fix: ReDoS problem (#224)
1 parent 52cd134 commit d2d752d

File tree

2 files changed

+991
-897
lines changed

2 files changed

+991
-897
lines changed

lib/interpolateName.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function interpolateName(loaderContext, name, options = {}) {
7676
// `hash` and `contenthash` are same in `loader-utils` context
7777
// let's keep `hash` for backward compatibility
7878
.replace(
79-
/\[(?:([^:\]]+):)?(?:hash|contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi,
79+
/\[(?:([^[:\]]+):)?(?:hash|contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi,
8080
(all, hashType, digestType, maxLength) =>
8181
getHashDigest(content, hashType, digestType, parseInt(maxLength, 10))
8282
);

0 commit comments

Comments
 (0)