Skip to content

Commit a788c4b

Browse files
committed
Modify Regex to avoid ReDoS
1 parent 8f082b3 commit a788c4b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/interpolateName.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function interpolateName(loaderContext, name, options) {
108108
// `hash` and `contenthash` are same in `loader-utils` context
109109
// let's keep `hash` for backward compatibility
110110
.replace(
111-
/\[(?:([^:\]]+):)?(?:hash|contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi,
111+
/\[(?:([^\[:\]]+):)?(?:hash|contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi,
112112
(all, hashType, digestType, maxLength) =>
113113
getHashDigest(content, hashType, digestType, parseInt(maxLength, 10))
114114
)

0 commit comments

Comments
 (0)