fix: prevent ReDoS in UriTemplate regex patterns (v1.x backport) (#1365)
This commit is contained in:
parent
a0c9b13484
commit
b392f02ffc
1 changed files with 32 additions and 5 deletions
|
|
@ -225,7 +225,7 @@ export class UriTemplate {
|
|||
|
||||
switch (part.operator) {
|
||||
case '':
|
||||
pattern = part.exploded ? '([^/]+(?:,[^/]+)*)' : '([^/,]+)';
|
||||
pattern = part.exploded ? '([^/,]+(?:,[^/,]+)*)' : '([^/,]+)';
|
||||
break;
|
||||
case '+':
|
||||
case '#':
|
||||
|
|
@ -235,7 +235,7 @@ export class UriTemplate {
|
|||
pattern = '\\.([^/,]+)';
|
||||
break;
|
||||
case '/':
|
||||
pattern = '/' + (part.exploded ? '([^/]+(?:,[^/]+)*)' : '([^/,]+)');
|
||||
pattern = '/' + (part.exploded ? '([^/,]+(?:,[^/,]+)*)' : '([^/,]+)');
|
||||
break;
|
||||
default:
|
||||
pattern = '([^/]+)';
|
||||
|
|
|
|||
Loading…
Reference in a new issue