8000 fix!: support IPv6 address as custom GCE_METADATA_HOST by marqc · Pull Request #2592 · googleapis/google-api-java-client · GitHub
[go: up one dir, main page]

Skip to content
Dismiss alert

fix!: support IPv6 address as custom GCE_METADATA_HOST #2592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

marqc
Copy link
@marqc marqc commented Jun 6, 2025

The url for metadata server would fail if user provided IPv6 address as GCE_METADATA_HOST env.
For backwards compatibility new code accepts the following:

  • domain, i.e. mymetadataserver.domain.com
  • domain with port, i.e. mymetadataserver.domain.com:8080
  • IPv4 address, i.e. 127.0.0.1
  • IPv4 address with port, i.e. 127.0.0.1:8080
  • IPv6 address, i.e. ::1
  • IPv6 address within square brackers, i.e. [::1]
  • IPv6 address with port, i.e. [::1]:8080

As the new code performs URL validation, it will fallback to the DEFAULT_METADATA_SERVER_URL if provided env variable results in invalid URL (this is behavioral change as prior to it, the malformed URL would be passed to upper layers and result in invalid request attempt).

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing 8000 your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #2591 ☕️

If you write sample code, please follow the samples format.

@marqc marqc requested a review from a team as a code owner June 6, 2025 09:54
@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Jun 6, 2025
@marqc marqc force-pushed the ipv6_metadata_server branch 2 times, most recently from 8dbf88e to c1b0777 Compare June 6, 2025 10:19
@marqc marqc changed the title Fix usage of IPv6 address as custem GCE_METADATA_HOST fix!: support IPv6 address as custem GCE_METADATA_HOST Jun 6, 2025
@marqc marqc changed the title fix!: support IPv6 address as custem GCE_METADATA_HOST fix!: support IPv6 address as custom GCE_METADATA_HOST Jun 6, 2025
The url for metadata server would fail if user provided IPv6 address as
GCE_METADATA_HOST env.
For backwards compatibility new code accepts the following:
  * domain, i.e. `mymetadataserver.domain.com`
  * domain with port, i.e. `mymetadataserver.domain.com:8080`
  * IPv4 address, i.e. `127.0.0.1`
  * IPv4 address with port, i.e. `127.0.0.1:8080`
  * IPv6 address, i.e. `::1`
  * IPv6 address within square brackers, i.e. `[::1]`
  * IPv6 address with port, i.e. `[::1]:8080`

BREAKING CHANGE: As the new code performs URL validation, it will fallback to the `DEFAULT_METADATA_SERVER_URL` if provided env variable results in invalid URL (this is behavioral change as prior to it, the malformed URL would be passed to upper layers and result in invalid request attempt).

Signed-off-by: Marek Chodor <mchodor@google.com>
@marqc marqc force-pushed the ipv6_metadata_server branch from c1b0777 to 65bb25e Compare June 6, 2025 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GCE_METADATA_HOST env does not work with IPv6 addresses
1 participant
0