Skip to content

fix(storage): resolve HttpStorageOptions default host from the configured universe domain - #15235

Open
nidhiii-27 wants to merge 6 commits into
mainfrom
fix/storage-universe-domain-env
Open

nidhiii-27 wants to merge 6 commits into
mainfrom
fix/storage-universe-domain-env

Conversation

@nidhiii-27

@nidhiii-27 nidhiii-27 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

StorageOptions resolves the configured universe domain and validates it the same way ServiceOptions.resolveUniverseDomain() does; HttpStorageOptions and GrpcStorageOptions derive their default storage host from it, and StorageImpl and StorageClientMetrics use the same resolved universe domain. Explicit setHost() values and getUniverseDomain() are unchanged, and an explicit setHost("https://www.googleapis.com") resolves to the storage host for the configured universe domain. StorageOptionsTest covers default host resolution, empty-value validation, and V4 signed URL hosts.

@nidhiii-27 nidhiii-27 added ai-generated Pull Request generated by AI storage-bug-immunity labels Nov 25, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for resolving and validating the Google Cloud Universe Domain across both HTTP and gRPC storage clients. It updates StorageOptions to dynamically resolve the universe domain from either an explicit builder configuration or the GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable, while preserving manually set hosts. Additionally, it adds validation to ensure that signing credentials match the configured universe domain, and fixes canonical header generation for signed URLs. Extensive unit and integration tests are added to verify these behaviors. Feedback was provided to improve the validation of the explicitly configured universe domain by checking for blank strings (containing only whitespace) rather than just empty strings, preventing potential downstream URI parsing issues.

@nidhiii-27
nidhiii-27 force-pushed the fix/storage-universe-domain-env branch from 36fc74d to ea928bc Compare November 25, 2026 08:46
@nidhiii-27 nidhiii-27 changed the title fix(storage): honor GOOGLE_CLOUD_UNIVERSE_DOMAIN across gRPC, HTTP, and URL signing fix(storage): make universe domain resolution consistent with EndpointContext Nov 25, 2026
@nidhiii-27
nidhiii-27 force-pushed the fix/storage-universe-domain-env branch from ea928bc to 6c01bec Compare November 25, 2026 13:46
@nidhiii-27 nidhiii-27 changed the title fix(storage): make universe domain resolution consistent with EndpointContext fix(storage): make HttpStorageOptions universe domain resolution consistent with EndpointContext Nov 25, 2026
…se domain on build()

HttpStorageOptions.Builder now resolves the default host from the configured universe domain each time build() is called, unless a host was set with setHost(...). Hosts set with setHost(...) are used as before. Host-resolution tests were added to StorageOptionsBuilderTest.
…ured universe domain

StorageOptions resolves the configured universe domain, the same way EndpointContext does, and HttpStorageOptions derives its default host from it. Explicit setHost() values and getUniverseDomain() are unchanged, and an explicit setHost("https://www.googleapis.com") resolves to the storage host for the configured universe domain. StorageOptionsTest adds host-resolution cases.
@nidhiii-27
nidhiii-27 force-pushed the fix/storage-universe-domain-env branch from 6c01bec to fa26520 Compare November 27, 2026 06:51
@nidhiii-27
nidhiii-27 changed the base branch from main to fix-http-storage-options-tobuilder-universe-domain November 27, 2026 06:51
@nidhiii-27 nidhiii-27 changed the title fix(storage): make HttpStorageOptions universe domain resolution consistent with EndpointContext fix(storage): resolve HttpStorageOptions default host from the configured universe domain Nov 27, 2026
@nidhiii-27
nidhiii-27 marked this pull request as ready for review November 27, 2026 06:52
@nidhiii-27
nidhiii-27 requested review from a team as code owners November 27, 2026 06:52
@nidhiii-27 nidhiii-27 added kokoro:force-run Add this label to force Kokoro to re-run the tests. and removed kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Nov 27, 2026
@nidhiii-27
nidhiii-27 requested a review from Dhriti07 December 1, 2026 06:19
Base automatically changed from fix-http-storage-options-tobuilder-universe-domain to main December 2, 2026 10:26
…domain-env

# Conflicts:
#	java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/HttpStorageOptions.java
#	java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageOptions.java
HttpStorageOptions.Builder.build() resolves the storage host before constructing HttpStorageOptions when no custom host is set, and re-resolves only when an explicit host equals the ServiceOptions default host. Custom hosts and explicit universe domain resolution remain unchanged. StorageOptionsTest adds a toBuilder() universe-domain assertion, and the StorageOptions.usesDefaultHost() Javadoc links getResolvedUniverseDomain().

[Generated-by: AI]
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 2, 2026
@nidhiii-27
nidhiii-27 requested a review from Dhriti07 December 2, 2026 11:43
…domain-env

# Conflicts:
#	java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageClientMetrics.java
#	java-storage/google-cloud-storage/src/test/java/com/google/cloud/storage/StorageOptionsTest.java
…rviceOptions

StorageOptions rejects an empty universe domain with IllegalArgumentException("The universe domain cannot be empty"), as ServiceOptions.resolveUniverseDomain() does, and HttpStorageOptions.Builder.build() and GrpcStorageOptions.Builder.build() apply this check when options are built. StorageOptions.resolveUniverseDomain() returns the same resolved universe domain used for the default host. Unset and non-empty universe domains and explicit custom hosts are unchanged; StorageOptionsTest covers the empty-value check.

[Generated-by: AI]

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated Pull Request generated by AI storage-bug-immunity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants