From 1ebdf1f0ed82180843180f6b217c55386e6f922f Mon Sep 17 00:00:00 2001 From: brysonjbest <103070659+brysonjbest@users.noreply.github.com> Date: Tue, 30 Jul 2024 14:11:25 -0700 Subject: [PATCH] Update to address security vulnerability with data input. --- src/api/ruleMapping/ruleMapping.service.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/api/ruleMapping/ruleMapping.service.ts b/src/api/ruleMapping/ruleMapping.service.ts index 15b9e16..f87b338 100644 --- a/src/api/ruleMapping/ruleMapping.service.ts +++ b/src/api/ruleMapping/ruleMapping.service.ts @@ -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); if (match) { - const item = line.replace(match[0], '').trim(); + const item = match[1].trim(); acc.push({ key: item, property: item,