From 7af427c812a70260eb7a973d4f016ee54bbe4a8b Mon Sep 17 00:00:00 2001 From: Prince Rajpoot Date: Sun, 10 Sep 2023 03:15:56 +0530 Subject: [PATCH] Fix Warnings: Generic Object Injection Sink --- src/controllers/help.controller.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controllers/help.controller.ts b/src/controllers/help.controller.ts index caa33fd8..8ef78f27 100644 --- a/src/controllers/help.controller.ts +++ b/src/controllers/help.controller.ts @@ -18,7 +18,7 @@ const getPathKeysMatchingCommands = (commands: string[], pathKeys: string[]): st return pathKeys.find(pathKey => { const pathParts = pathKey.split('/').filter(part => part !== ''); return pathParts.every((pathPart, i) => { - const command = commands[i]; + const command = commands[Number(i)]; return pathPart === command || pathPart.startsWith('{'); }); }); @@ -70,9 +70,9 @@ export class HelpController implements Controller { })); } - const pathInfo = isKeyValid(matchedPathKey, openapiSpec.paths) ? openapiSpec.paths[matchedPathKey] : undefined; + const pathInfo = isKeyValid(matchedPathKey, openapiSpec.paths) ? openapiSpec.paths[String(matchedPathKey)] : undefined; const method = commands.length > 1 ? 'get' : 'post'; - const operationDetails = isKeyValid(method, pathInfo) ? pathInfo[method] : undefined; + const operationDetails = isKeyValid(method, pathInfo) ? pathInfo[String(method)] : undefined; if (!operationDetails) { return next(new ProblemException({ type: 'invalid-asyncapi-command',