Installation
If your organization uses AWS HTTP API Gateway with a NodeJS Lambda integration, you can use the HUMAN API Gateway Enforcer to protect your API Gateway against malicious behavior. The HUMAN enforcer easily integrates into your existing AWS Lambda function.
Prerequisites
- An existing AWS HTTP API Gateway
- A NodeJS Lambda integration with Node v16.x or later.
Note
For the HUMAN AWS HTTP API Gateway Enforcer to be compatible with your AWS Lambda function integration, the AWS Lambda function must use v2 of the payload format structure.
Installation
- Install the Enforcer using NPM package in your project.
npm install @humansecurity/aws-api-gateway-enforcer
- Save your handler in a constant
import { APIGatewayProxyEventV2 } from 'aws-lambda';
const myHandler = (event: APIGatewayProxyEventV2): Promise<APIGatewayProxyStructuredResultV2> => {
// ... original lambda handler code
}
- Export HUMAN Security's handler from your Lambda.
import { handler as humanSecurityHandler } from "@humansecurity/aws-api-gateway-enforcer";
const pxConfig = {
onPass: myHandler,
px_app_id: "<APP_ID>",
px_cookie_secret: "<COOKIE_SECRET>",
px_auth_token: "<AUTH_TOKEN>"
// ...
};
export const handler = humanSecurityHandler(pxConfig);
- Deploy the AWS Lambda function and API Gateway.
Updated 12 days ago