-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(appsync): Lambda authorizer permission is not scoped to appsync api arn #31550
(appsync): Lambda authorizer permission is not scoped to appsync api arn #31550
Comments
Agree. When aws-cdk/packages/aws-cdk-lib/aws-appsync/lib/graphqlapi.ts Lines 699 to 701 in c4bda64
Making it a p1. |
Bump to p0 now. We are confirming some details before the fix. |
Reducing the severity. We will incorporate the best practice as a fix for this issue. However current assessment does not make it clear that it is a security risk. |
Comments on closed issues and PRs are hard for our team to see. |
1 similar comment
Comments on closed issues and PRs are hard for our team to see. |
Fix is behind a feature flag: {
"context": {
"@aws-cdk/aws-ec2:appSyncGraphQLAPIScopeLambdaPermission": true
}
} Please note that this fix adds a sourceArn which will cause a REPLACEMENT of your |
Describe the bug
When using a lambda authorizer with a
GraphqlAPI
, the cdk automatically creates theAWS::Lambda::Permission
required for the AppSync API to invoke the lambda authorizer. It does not however add aSourceArn
.This conflicts with the control tower policy [CT.LAMBDA.PR.2], and it is in general good practice to scope permissions.
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
I expected that the
AWS::Lambda::Permission
was scoped to only allow the "parent" AppSync API to invoke the authorizer.Current Behavior
The CDK outputs a
AWS:Lambda::Permission
without aSourceArn
property.Reproduction Steps
defaultAuthorization
(oradditionalAuthorizationTypes
it doesn't matter) toaws_appsync.AuthorizationType.LAMBDA
and point to the created lambda functionAWS::Lambda::Permission
and notice thatSourceArn
is missing.Possible Solution
Inspecting the
aws_appsync
package reveals that appsync adds this permission when discovering anauthorizationType === AuthorizationType.LAMBDA
.The fix should be as simple as adding
sourceArn: this.arn
, but I don't have the time currently to setup local development and create a pull request.Additional Information/Context
A workaround for now is to modify the permission with an
Aspect
:CDK CLI Version
2.159.1 (build c66f4e3)
Framework Version
No response
Node.js Version
v20.13.1
OS
MacOS 14.6.1 (Sonoma)
Language
TypeScript
Language Version
Typescript (5.6.2)
Other information
No response
The text was updated successfully, but these errors were encountered: