Skip to content

Commit

Permalink
fix: ReDoS problem (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait authored Nov 11, 2022
1 parent 52cd134 commit d2d752d
Show file tree
Hide file tree
Showing 2 changed files with 991 additions and 897 deletions.
2 changes: 1 addition & 1 deletion lib/interpolateName.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function interpolateName(loaderContext, name, options = {}) {
// `hash` and `contenthash` are same in `loader-utils` context
// let's keep `hash` for backward compatibility
.replace(
/\[(?:([^:\]]+):)?(?:hash|contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi,
/\[(?:([^[:\]]+):)?(?:hash|contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi,
(all, hashType, digestType, maxLength) =>
getHashDigest(content, hashType, digestType, parseInt(maxLength, 10))
);
Expand Down
Loading

0 comments on commit d2d752d

Please sign in to comment.