CloudFront distributions should use origin access control for Lambda function URL origins
Checks that every Lambda function URL origin of a CloudFront distribution uses origin access control (OAC), so CloudFront signs its requests and the URL can refuse everyone else. The check reads the attachment only: it passes while the function URL's auth type is still NONE, which leaves the URL open to the internet.
- service
- CloudFront
- severity
- Medium
- scope
- evaluated once per account
How to fix it
- Interrupts service: Grant cloudfront.amazonaws.com first, and set the auth type to AWS_IAM only after the distribution deploys with the OAC: until then CloudFront's requests are unsigned and refused.
- Can break clients: Callers using the function URL directly are refused once it is AWS_IAM, and clients sending POST or PUT through the distribution must put the body's SHA256 in x-amz-content-sha256.
In the console
CloudFront → Distributions → the distribution → Origins → the Lambda function URL origin → Edit
- Origin access control
- One with Origin type Lambda and Signing behavior Sign requests (recommended), on every function URL origin
- Lambda → Configuration → Function URL → Auth type
- AWS_IAM, which OAC requires; this check does not read it
- Resource-based policy (aws lambda add-permission)
- cloudfront.amazonaws.com for lambda:InvokeFunctionUrl and lambda:InvokeFunction, --source-arn the distribution ARN
See which of your accounts this check is failing on.
Book a live scan