Skip to main content


Ensure no Object Storage buckets are publicly visible (Automated)


A bucket is a logical container for storing objects. It belongs to a single compartment that has policies that determine what action a user can perform on a bucket and on all the objects in the bucket. Best practices recommend that no bucket be publicly accessible.


From Console:

  1. Login into the OCI Console.

  2. Click in the search bar at the top of the screen.

  3. Type Advanced Resource Query and hit enter.

  4. Click the Advanced Resource Query button in the upper right of the screen.

  5. Enter the following query in the query box:

    query bucket resources where (publicAccessType == 'ObjectRead') || (publicAccessType == 'ObjectReadWithoutList')
  6. For each bucket in the returned results, click the Bucket Display Name.

  7. Click Edit Visibility.

  8. Select Private.

  9. Click Save Changes.

From CLI:

  1. Execute the following command:
oci search resource structured-search --query-text "query bucket resources where
(publicAccessType == 'ObjectRead') || (publicAccessType == 'ObjectReadWithoutList')"
  1. For each of the buckets identified, execute the following command:
oci os bucket update --bucket-name <bucket-name> --public-access-type NoPublicAccess


For updating an existing bucket, ensure it is possible to access objects in the bucket through either Identity and Access Management (IAM) policies or pre-authenticated requests.