Skip to content

[apigw-to-private-apig-cdk] Overly permissive API Gateway Resource Policy #935

@ryanotella

Description

@ryanotella

Great example! However, the Resource Policy in the apigw-to-private-apig-cdk pattern currently allows API traffic from any VPCE in the region. So while it prevents direct access from the public internet, it probably is not what most users are expecting.

const apiResourcePolicy = new iam.PolicyDocument({
statements: [
new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: ['execute-api:Invoke'],
principals: [new iam.AnyPrincipal()],
resources: ['execute-api:/*/*/*'],
})
]
});

The PolicyDocument needs to be updated with a "Deny" statement restricting access to only the VPCE (or VPC) created by the stack. I'm happy to submit a PR if you're accepting them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions