Info icon
End of Life Notice: For Trend Cloud One™ - Conformity Customers, Conformity will reach its End of Sale on “July 31st, 2025” and End of Life “July 31st, 2026”. The same capabilities and much more is available in TrendAI Vision One™ Cloud Risk Management. For details, please refer to Upgrade to TrendAI Vision One™

Define index page suffix and error page for the bucket website configuration

TrendAI Vision One™ provides continuous assurance that gives peace of mind for your cloud infrastructure, delivering over 1400 automated best practice checks.

Risk Level: Medium (should be achieved)
Rule ID: CloudStorage-005

Ensure that website index (main) page suffix and error (404 not found) page are defined for your Google Cloud storage buckets with static website configuration. When you specify the main page suffix, if the suffix is set as "index.html," example.com will serve visitors the content from the object example.com/index.html if it exists. Additionally, if you specify an error (404 not found) page, if a user visits example.com/directory and neither that URL nor example.com/directory/index.html points to an object, the error page will be served.

This check applies only to Cloud Storage buckets that grant public read access, i.e. buckets that grant read access to the allUsers or allAuthenticatedUsers principal. Buckets without public read access cannot serve a static website to external visitors and are not evaluated by this check.

This rule can help you with the following compliance standards:

  • NIST5

For further details on compliance standards supported by TrendAI Vision One™ Cloud Risk Management, see here.

Reliability

Configuring the "website.mainPageSuffix" and "website.notFoundPage" properties for your static website hosted on a storage bucket in Google Cloud is vital for ensuring the desired behavior and optimal user experience. By setting these properties, you enhance the user-friendliness of your website and minimize the occurrence of errors or bounce rates. This configuration plays a key role in ensuring that your website behaves as expected, providing a seamless browsing experience for your visitors.

Because only publicly-accessible buckets (i.e., buckets that grant read access to allUsers or allAuthenticatedUsers) can serve content to external website visitors, this check excludes buckets without public read access. This avoids false positives on buckets that are used for internal purposes and were never intended to host a publicly-reachable static website.


Audit

To determine if the static website configuration for your Google Cloud storage bucket includes the website index page suffix and error page, first confirm that the bucket grants public read access, then perform the following actions:

Using GCP Console

  1. Sign in to Google Cloud Management Console.

  2. Select the Google Cloud Platform (GCP) project that you want to examine from the console top navigation bar.

  3. Navigate to Cloud Storage console available at https://console.cloud.google.com/storage.

  4. In the main navigation panel, select Buckets to access the list with all the Cloud Storage buckets created for the selected GCP project.

  5. Choose the storage bucket that you want to examine and select the Permissions tab. Check whether the allUsers or allAuthenticatedUsers principal is granted the Storage Object Viewer role (or another role/permission that includes storage.objects.get). If neither principal is granted this access, the selected bucket is not publicly accessible, the index page suffix and error page check does not apply to it, and you should skip to the next bucket.

  6. If the bucket is publicly accessible, click Edit bucket at the top of the bucket details page, and expand the Website Config section.

  7. In the Website Config section, check the Index (main) page suffix and Error (404 not found) page fields to determine if the bucket website configuration specifies the index page suffix and error page for the hosted website. If both Index (main) page suffix and Error (404 not found) page fields are empty, the index page suffix and error page are not defined in the static website configuration set for the selected Google Cloud Storage bucket.

  8. Repeat steps no. 5 – 7 for each storage bucket that you want to examine, created for the selected GCP project.

  9. Repeat steps no. 2 – 8 for each project deployed in your Google Cloud Platform (GCP) account.

Using GCP Command Line Interface (CLI)

  1. Run projects list command (Windows/macOS/Linux) with custom query filters to list the ID of each Google Cloud Platform (GCP) project available in your cloud account:

    gcloud projects list --format="table(projectId)"
    
  2. The command output should return the requested GCP project ID(s):

    PROJECT_ID
    cc-web-project-112233
    cc-data-project-111222
    
  3. Run gsutil ls command (using gsutil Python tool) to list the identifier of each Cloud Storage bucket created for the specified GCP project:

    gsutil ls -p cc-web-project-112233
    
  4. The command output should return the requested storage resource name(s):

    gs://trendmicro.com/
    gs://cc-logs-bucket/
    
  5. Run gsutil iam get command (using gsutil tool) using the name of the Cloud Storage bucket that you want to examine as the identifier parameter, to retrieve the IAM policy bindings for the selected bucket and confirm whether it grants public read access:

    gsutil iam get gs://trendmicro.com
    
  6. The command output should return the requested IAM policy information:

    {
      "bindings": [
        {
          "members": [
            "projectEditor:my-project",
            "projectOwner:my-project"
          ],
          "role": "roles/storage.legacyBucketOwner"
        },
        {
          "members": [
            "projectViewer:my-project"
          ],
          "role": "roles/storage.legacyBucketReader"
        },
        {
          "members": [
            "allUsers"
          ],
          "role": "roles/storage.objectViewer"
        }
      ],
      "etag": "CAI="
    }
    

    If the bindings array does not include a role binding that grants the roles/storage.objectViewer role (or another role/permission that includes storage.objects.get) to the allUsers or allAuthenticatedUsers member, the selected bucket is not publicly accessible, the index page suffix and error page check does not apply to it, and you should skip to the next bucket.

  7. Run gsutil web get command (using gsutil tool) using the name of the Cloud Storage bucket that you want to examine as the identifier parameter, to describe the static website configuration available for the selected bucket:

    gsutil web get gs://trendmicro.com
    
  8. The command output should return the requested configuration information:

    gs://trendmicro.com/ has no website configuration.
    

    If the gsutil web get command output returns "[storage-bucket] has no website configuration.", where [storage-bucket] is the name of the verified bucket, or the command output does not return values for both "notFoundPage" and "mainPageSuffix" configuration attributes, the index page suffix and error page are not defined in the static website configuration for the selected Google Cloud Storage bucket.

  9. Repeat steps no. 5 – 8 for each storage bucket that you want to examine, available in the selected GCP project.

  10. Repeat step no. 1 – 9 for each GCP project created within your Google Cloud Platform (GCP) account.

Remediation / Resolution

To define the index (main) page suffix and error (404 not found) page for your bucket website configuration, perform the following actions. This remediation applies to publicly-accessible Cloud Storage buckets that are intended to host a static website. If static website hosting is not intended for a publicly-accessible bucket, removing its public read access (i.e., revoking the allUsers / allAuthenticatedUsers role binding) is a valid alternative remediation that also resolves this finding.

Using GCP Console

  1. Sign in to Google Cloud Management Console.

  2. Select the Google Cloud Platform (GCP) project that you want to examine from the console top navigation bar.

  3. Navigate to Cloud Storage console available at https://console.cloud.google.com/storage.

  4. In the main navigation panel, select Buckets to access the list with all the Cloud Storage buckets provisioned for the selected GCP project.

  5. Choose the storage bucket that you want to reconfigure and click Edit bucket at the top of the bucket details page.

  6. Expand the Website Config section, provide a suffix to append to the URL when visitors request your website top-level domain or URLs without associated objects in the Index (main) page suffix field, and specify a 404 Not Found page to serve when visitors request a URL that directs to no object or the index page in the Error (404 not found) page field. Choose Continue.

  7. Choose Continue through the remaining configuration steps (Choose how to store your data, Choose how to control access to objects) without changing any existing settings, then choose Save Changes to apply the website configuration.

  8. Repeat steps no. 5 – 7 for each storage bucket that you want to reconfigure, created for the selected GCP project.

  9. Repeat steps no. 2 – 8 for each project deployed in your Google Cloud Platform (GCP) account.

Using GCP Command Line Interface (CLI)

  1. Run gsutil web set command (using gsutil Python tool) using the name of the Google Cloud Storage bucket that you want to reconfigure as the identifier parameter, to define the index (main) page suffix and error (404 not found) page for the static website configuration set for the selected bucket:

    gsutil web set -m "index.html" -e "404.html" gs://trendmicro.com
    
  2. If successful, the command output should return the gsutil web set request status:

    Setting website configuration on gs://trendmicro.com/...
    
  3. Run gsutil web get command (using gsutil tool) using the name of the reconfigured bucket as the identifier parameter, to describe the current static website configuration available for the selected bucket:

    gsutil web get gs://trendmicro.com
    
  4. The command output should return the requested configuration information. If the website configuration has been successfully applied, both "notFoundPage" and "mainPageSuffix" attributes should return values:

    {
        "mainPageSuffix": "index.html",
        "notFoundPage": "404.html"
    }
    
  5. Repeat steps no. 1 – 4 for each storage bucket that you want to reconfigure, available in the selected GCP project.

  6. Repeat steps no. 1 – 5 for each project created within your Google Cloud Platform (GCP) account.

References

Publication date May 25, 2023