Skip to content

aws-cloudfront: cloudfront:ListDistributions does not support resource-level #33249

@steven10172

Description

@steven10172

Describe the bug

When using the grantXXX command on a resource it applies the actions against the ARN of the current resources. While this is often what you want, some AWS services and actions do not support resource-level protection and require the use of wildcards. For example, when specifying cloudfront:ListDistributions the resource must be * otherwise it will fail.

To assist users in this process the grantXXX function for CloudFront should be updated to use * when cloudfront:ListDistributions is present within the action list.

https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

When using the grantXXX function for CloudFront with cloudfront:ListDistributions the resource field should be *

Current Behavior

The resource field is the ARN of the distribution which fails.

Reproduction Steps

Create a test role that uses cloudfront:ListDistributions and set the resource to a specific distribution id and then run the list command, it will fail stating that permissions are lacking.

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.160.0

Framework Version

No response

Node.js Version

20.11.1

OS

Mac 13.7.2

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-cloudfrontRelated to Amazon CloudFrontbugThis issue is a bug.effort/smallSmall work item – less than a day of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions