Skip to content

Commit f08906c

Browse files
Fix code scanning alert no. 307: Prototype-polluting assignment
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 6410841 commit f08906c

File tree

1 file changed

+6
-0
lines changed
  • packages/aws-serverless/src

1 file changed

+6
-0
lines changed

packages/aws-serverless/src/sdk.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ export function tryPatchHandler(taskRoot: string, handlerPath: string): void {
168168
return;
169169
}
170170

171+
// Check for prototype pollution
172+
if (functionName === '__proto__' || functionName === 'constructor' || functionName === 'prototype') {
173+
DEBUG_BUILD && logger.error(`Invalid handler name: ${functionName}`);
174+
return;
175+
}
176+
171177
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
172178
(mod as HandlerModule)[functionName!] = wrapHandler(obj);
173179
}

0 commit comments

Comments
 (0)