diff --git a/docs/lambda.md b/docs/lambda.md index 72f118fe8..8a271b1da 100644 --- a/docs/lambda.md +++ b/docs/lambda.md @@ -11,7 +11,7 @@ const dependency = require("dependency"); preventPrototypePollution(); // <-- Call this after your main imports -exports.handler = protect(async (event, context) => { +exports.handler = protect(async (event, context) => { // <-- Wrap your handler with protect // ... }); ``` @@ -27,8 +27,7 @@ import { lambda, preventPrototypePollution } from '@aikidosec/guard'; In order for the guard to work properly, we need the following event properties to be present: * `event.body` -* `event.httpMethod` (optional) -* `event.headers` (optional) +* `event.headers` That's it! Your AWS Lambda function is now protected by Aikido guard. diff --git a/library/src/sources/Lambda.ts b/library/src/sources/Lambda.ts index bf4671c68..3d783782e 100644 --- a/library/src/sources/Lambda.ts +++ b/library/src/sources/Lambda.ts @@ -89,12 +89,7 @@ function isJsonContentType(contentType: string) { } function isProxyEvent(event: unknown): event is APIGatewayProxyEvent { - return ( - isPlainObject(event) && - "httpMethod" in event && - "requestContext" in event && - "headers" in event - ); + return isPlainObject(event) && "httpMethod" in event && "headers" in event; } export function createLambdaWrapper<