Skip to content

Commit

Permalink
Update to address security vulnerability with data input.
Browse files Browse the repository at this point in the history
  • Loading branch information
brysonjbest committed Jul 30, 2024
1 parent e2c41fc commit 1ebdf1f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/api/ruleMapping/ruleMapping.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ export class RuleMappingService {
};
});
} else if (node.type === 'functionNode' && node?.content) {
return (node.content.split('\n') || []).reduce((acc: any, line: string) => {
const match = line.match(fieldKey === 'inputs' ? /\s*\*\s*@param\s+/ : /\s*\*\s*@returns\s+/);
return (node.content.split('\n') || []).reduce((acc: any[], line: string) => {
const pattern = fieldKey === 'inputs' ? /^\s*\*\s*@param\s+(.+)$/ : /^\s*\*\s*@returns\s+(.+)$/;
const match = line.match(pattern);

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on
a user-provided value
may run slow on strings starting with '*@param ' and with many repetitions of ' '.
This
regular expression
that depends on
a user-provided value
may run slow on strings starting with '*@returns ' and with many repetitions of ' '.
This
regular expression
that depends on
a user-provided value
may run slow on strings starting with '*@param ' and with many repetitions of ' '.
This
regular expression
that depends on
a user-provided value
may run slow on strings starting with '*@returns ' and with many repetitions of ' '.
This
regular expression
that depends on
a user-provided value
may run slow on strings starting with '*@param ' and with many repetitions of ' '.
This
regular expression
that depends on
a user-provided value
may run slow on strings starting with '*@returns ' and with many repetitions of ' '.
This
regular expression
that depends on
a user-provided value
may run slow on strings starting with '*@param ' and with many repetitions of ' '.
This
regular expression
that depends on
a user-provided value
may run slow on strings starting with '*@returns ' and with many repetitions of ' '.
This
regular expression
that depends on
a user-provided value
may run slow on strings starting with '*@param ' and with many repetitions of ' '.
This
regular expression
that depends on
a user-provided value
may run slow on strings starting with '*@returns ' and with many repetitions of ' '.
if (match) {
const item = line.replace(match[0], '').trim();
const item = match[1].trim();
acc.push({
key: item,
property: item,
Expand Down

0 comments on commit 1ebdf1f

Please sign in to comment.