Ensure Lambda functions restrict public access to enhance security measures.
Rule | Lambda functions should restrict public access |
Framework | HIPAA |
Severity | ✔ Critical |
Ensuring AWS Lambda Functions Restrict Public Access for HIPAA Compliance
AWS Lambda is a serverless compute service that lets you run code without provisioning or managing servers. For organizations that handle protected health information (PHI), such as those subject to the Health Insurance Portability and Accountability Act (HIPAA), it's vital to ensure that Lambda functions are not publicly accessible to prevent unauthorized access to PHI.
Why Restrict Public Access?
HIPAA rules require appropriate safeguards to protect the privacy of personal health information. Unrestricted public access to Lambda functions could expose sensitive health-related information, resulting in violations of HIPAA regulations and causing potential harm to individuals’ privacy.
How to Restrict Public Access
Use AWS Identity and Access Management (IAM)
IAM Policies: Attach policies to Lambda execution roles to explicitly define who can invoke your Lambda function.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "lambda:InvokeFunction",
"Resource": "arn:aws:lambda:region:account-id:function:function-name",
"Principal": {
"AWS": "arn:aws:iam::account-id:root"
}
}
]
}
IAM Roles: Create a role with the necessary permissions for the Lambda function to access other AWS resources securely.
Utilize AWS Resource-Based Policies
Resource-based Policies: Attach a resource-based policy to your Lambda function. Resource policies control which AWS accounts or IAM users can invoke the function.
{
"Version": "2012-10-17",
"Id": "default",
"Statement": [
{
"Sid": "RestrictPublicAccess",
"Effect": "Deny",
"Principal": "*",
"Action": "lambda:InvokeFunction",
"Resource": "arn:aws:lambda:region:account-id:function:function-name",
"Condition": {
"StringNotEquals": {
"aws:PrincipalOrgID": "o-xxxxxxxxxxx"
}
}
}
]
}
Employ VPC and Security Groups
Disable Public and Cross-Account Invocations
Lambda Permissions: Ensure there are no permissions that allow public or cross-account invocations without proper authorization.
aws lambda remove-permission --function-name function-name \ --statement-id sid-to-remove
Regularly Review and Audit Permissions
Step by Step Guide for Remediation
Check Lambda Permissions
Configure IAM Properly
lambda:InvokeFunction
permission.Utilize a VPC
Use AWS Config Rules
Monitor with Amazon CloudTrail
Remove Unnecessary Permissions
Repeat Audits Periodically
By implementing these controls and regularly reviewing them, you can ensure that your AWS Lambda functions conform to HIPAA requirements and protect against unauthorized disclosure of PHI. Maintaining compliance is an ongoing process and these steps help establish a solid foundation for a secure serverless environment.