Skip to content

Commit

Permalink
Merge pull request #221 from snyk/fix/fix-regex-redos
Browse files Browse the repository at this point in the history
fix: avoid redos by replacing regex with string split
  • Loading branch information
JamesPatrickGill committed May 7, 2024
2 parents 9e24962 + 1f63d42 commit 8981b82
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/dep-graph-builders/pnpm/lockfile-parser/lockfile-v6.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ export class LockfileV6Parser extends PnpmLockfileParser {
// Dependency path and versions include transitive peer dependencies encapsulated in dependencies
// e.g. '/cdktf-cli@0.20.3(ink@3.2.0)(react@17.0.2)' -> cdktf-cli@0.20.3
public excludeTransPeerDepsVersions(fullVersionStr: string): string {
const match = fullVersionStr.match(/([^)]*)\(/);
return match?.[1] ?? fullVersionStr;
return fullVersionStr.split('(')[0];
}

public static isAbsoluteDepenencyPath(dependencyPath: string): boolean {
Expand Down

0 comments on commit 8981b82

Please sign in to comment.