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.
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:
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.
References
- Google Cloud Platform (GCP) Documentation
- Host a static website
- Static website examples and tips
- Overview of access control
- GCP Command Line Interface (CLI) Documentation
- gcloud projects list
- gsutil ls
- gsutil iam
- gsutil web