Skip to content

Commit

Permalink
Merge pull request #17 from AikidoSec/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
hansott authored Feb 16, 2024
2 parents 5fa2053 + 88e68b1 commit 54a18cb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
run: echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//}
- run: cd library && npm --no-git-tag-version version ${{ steps.get_version.outputs.tag }}
- run: make build
- run: cp LICENSE library && cp README.md library
- run: cd library && npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
File renamed without changes.
5 changes: 2 additions & 3 deletions docs/lambda.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
// ...
});
```
Expand All @@ -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.

Expand Down
7 changes: 1 addition & 6 deletions library/src/sources/Lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand Down

0 comments on commit 54a18cb

Please sign in to comment.