We're using google cloud storage as our CDN.
However, any visitors can list all files by typing: http://ourcdn.storage.googleapis.com/
How to disable it while all the files under the bucket is still public readable by default?
We previously set the acl using
gsutil defacl ch -g AllUsers:READ
To disable uniform bucket-level access on a bucket, you must first remove all IAM Conditions from that bucket's policy. For information on how to view and remove conditions from a bucket's policy, see Using IAM Conditions on bucket.
This page describes how to control access to buckets and objects using Identity and Access Management (IAM) permissions. IAM allows you to control who has access to your buckets and objects.
In GCP dashboard:
then, listing should be disabled.
Update:
as @Devy comment, just check the note below here
Note: roles/storage.objectViewer includes permission to list the objects in the bucket. If you don't want to grant listing publicly, use roles/storage.legacyObjectReader.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With