Skip to content

Commit

Permalink
fix(validation): remove potential regex crash
Browse files Browse the repository at this point in the history
Prevent possible catastrophic backtracking bug in URL regex
  • Loading branch information
cahilfoley authored Jun 26, 2019
1 parent 57b97ab commit 1191997
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/internal/patterns/validURL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const urlRegex: RegExp = new RegExp(
'|(\\d{1,3}\\.){3}\\d{1,3})', // IP address
'(\\:\\d+)?', // Optional port
'(\\/[-a-z\\d%_.~+]*)*', // Path
'(\\?[;&a-z\\d%_.~+=\\-/]*)?', // Optional query string
'(\\?(?:[;&a-z\\d%_.~+=\\-/]+[^#])*)?', // Optional query string
'(\\#[-a-z\\d_]*)?$', // Optional anchor hash
].join(''),
'i',
Expand Down

0 comments on commit 1191997

Please sign in to comment.