
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
amazon-api-gateway-secure-authorizer
Advanced tools
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.handlerConfigure 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
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.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.