Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
amazon-api-gateway-secure-authorizer
Advanced tools
Secure Lambda authorizer for HTTP API behind CloudFront
This is a Lambda authorizer for Amazon API Gateway that provides secure API key validation using AWS Secrets Manager. This authorizer is compatible with key rotation through AWS Secrets Manager versioning, implements constant-time comparison to prevent timing attacks, and includes comprehensive logging for security monitoring.
pip install amazon-api-gateway-secure-authorizer
SECRET_NAME
: The name or ARN of the secret in AWS Secrets ManagerSECRET_KEY_NAME
: The key name within the secret's JSON structure that contains the API keyHEADER_NAME
: (Optional) The name of the header containing the API key (default: "x-origin-verify"){
"your_key_name": "your-api-key-value"
}
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"secretsmanager:GetSecretValue"
],
"Resource": "arn:aws:secretsmanager:region:account-id:secret:secret-name"
}
]
}
The Lambda function handler is located at:
secure_authorizer.authorizer.handler
{
"headers": {
"x-origin-verify": "your-api-key-value"
}
}
Set up AWS Secrets Manager:
Configure Lambda Environment:
SECRET_NAME="your-secret-name"
SECRET_KEY_NAME="your-key-name"
HEADER_NAME="x-origin-verify" # Optional, this is the default
Deploy Lambda Function:
secure_authorizer.authorizer.handler
Configure API Gateway:
This authorizer supports seamless key rotation using AWS Secrets Manager's versioning:
The authorizer implements comprehensive error handling for various scenarios:
All errors are logged with appropriate detail levels while maintaining security.
The authorizer provides detailed logging at different levels:
Advantages over the simple authorizer:
This project is licensed under the MIT License. See the LICENSE file for details.
This software product is not affiliated with, endorsed by, or sponsored by Amazon Web Services (AWS) or Amazon.com, Inc. The use of the term "AWS" is solely for descriptive purposes to indicate that the software is compatible with AWS services. Amazon Web Services and AWS are trademarks of Amazon.com, Inc. or its affiliates.
FAQs
Secure Lambda authorizer for HTTP API behind CloudFront
We found that amazon-api-gateway-secure-authorizer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.