Skip to content

fix(storage): restore emulator credentials - #16687

Open
zhixiangli wants to merge 3 commits into
googleapis:mainfrom
zhixiangli:fix-storage-emulator-credentials
Open

zhixiangli wants to merge 3 commits into
googleapis:mainfrom
zhixiangli:fix-storage-emulator-credentials

Conversation

@zhixiangli

@zhixiangli zhixiangli commented Nov 19, 2026 •

Copy link
Copy Markdown

Summary

Restores insecure credentials for the Cloud Storage REST client when CLOUD_STORAGE_EMULATOR_ENDPOINT (or the deprecated CLOUD_STORAGE_TESTBENCH_ENDPOINT) is set, as in 2.x and as google/cloud/storage/doc/environment-variables.dox implies. gRPC and Async client credentials are unchanged.

Root Cause

When Oauth2CredentialsOption was removed in v3.0.0, storage::internal::DefaultOptions(std::shared_ptr<oauth2_internal::Credentials> const&, Options) became a pass-through that ignored its credentials parameter, and DefaultOptions(Options) set UnifiedCredentialsOption to MakeGoogleDefaultCredentials() whenever it was absent. As a result:

  1. Emulator regression (storage: CLOUD_STORAGE_EMULATOR_ENDPOINT no longer implies insecure credentials; client uses ADC and can hang for 15 minutes off-GCP (3.x regression) #16678): DefaultOptionsWithCredentials() built MakeInsecureCredentials() for the emulator, discarded them, and used Application Default Credentials instead. Off GCE, every request retried a failing metadata-server lookup until the retry policy expired (15 minutes by default). With ADC configured, the client sent real OAuth tokens to the plaintext emulator.
  2. Auth options dropped: the MakeAuthOptions(opts) passed to MakeGoogleDefaultCredentials() was discarded too, so token requests lost the client's tracing and logging settings.

Changes

  • google/cloud/storage/client.{h,cc}
    • DefaultOptions(Options) no longer sets credentials. The unused two-argument overload is removed.
    • DefaultOptionsWithCredentials(Options) sets UnifiedCredentialsOption unless the application did: MakeInsecureCredentials() for the emulator, otherwise MakeGoogleDefaultCredentials(MakeAuthOptions(opts)). As in 2.x, the auth options come from the application's options, captured before DefaultOptions() runs. CLOUD_STORAGE_ENABLE_TRACING therefore configures only the storage client, and the credentials keep using GOOGLE_CLOUD_CPP_ENABLE_TRACING.
  • google/cloud/storage/internal/grpc/default_options.cc
    • DefaultOptionsGrpc() calls the credential-neutral DefaultOptions() and uses Application Default Credentials unless UnifiedCredentialsOption is set, as before. The REST emulator endpoint therefore does not make gRPC clients insecure, and the gRPC testbench (CLOUD_STORAGE_EXPERIMENTAL_GRPC_TESTBENCH_ENDPOINT) still selects insecure credentials. The auth options are captured before DefaultOptions(), as in the REST client.
  • google/cloud/storage/doc/environment-variables.dox
    • Documents that CLOUD_STORAGE_EMULATOR_ENDPOINT makes storage::Client use insecure credentials unless the application sets UnifiedCredentialsOption, and that it does not change the gRPC endpoint or credentials.
  • Tests (client_test.cc, internal/grpc/default_options_test.cc):
    • REST: emulator and legacy testbench credentials, explicit-credential precedence, the Client constructor, MakeAuthOptions propagation from Options, and CLOUD_STORAGE_ENABLE_TRACING not reaching the credentials (which use GOOGLE_CLOUD_CPP_ENABLE_TRACING).
    • gRPC: the REST emulator variables don't change gRPC credentials, the gRPC testbench stays insecure, explicit credentials are kept, and CLOUD_STORAGE_ENABLE_TRACING does not reach the credentials.

Notes

  • Honoring GrpcCredentialOption in MakeGrpcClient() and AsyncClient (currently ignored, as on main) is handled separately in fix(storage): honor GrpcCredentialOption #16694. Changing it also affects URL signing for those clients, so it needs its own change and release note.
  • CLOUD_STORAGE_ENABLE_TRACING still configures only the storage client, as on main and in 2.x. In particular, CLOUD_STORAGE_ENABLE_TRACING=http does not log the OAuth token requests (which contain refresh tokens). Use GOOGLE_CLOUD_CPP_ENABLE_TRACING=auth to debug the credentials.

Testing

  • bazel test --test_tag_filters=-integration-test //google/cloud/storage/...: 189/189 pass. A -fno-exceptions build of //:storage and //:storage_grpc succeeds.

  • Emulator, storage::Client() with no explicit credentials:

    Environment main This PR
    Dev machine with ADC sends the user's bearer token to the emulator no Authorization header
    GCE, no ADC file fails before reaching the emulator OK
    Off GCP, no ADC UNAVAILABLE after the retry window OK immediately
  • Real GCS: REST, gRPC and Async smoke tests and CreateClientIntegrationTest pass.

  • Real GCS logging: with CLOUD_STORAGE_ENABLE_TRACING=http the logs contain no refresh_token, and with GOOGLE_CLOUD_CPP_ENABLE_TRACING=auth plus CLOUD_STORAGE_ENABLE_TRACING=raw-client the credential logs are still emitted, both matching main.

  • gRPC and signing parity with main on real GCS and IAM: data-plane reads, IAM SignBlob signed URLs (GET returns 200), and local signing all behave identically.

Fixes #16678

@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Nov 19, 2026

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

Copy link
Copy Markdown

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 refactors the storage client's option and credential initialization to properly support gRPC clients that do not use UnifiedCredentialsOption. Specifically, it ensures that DefaultOptions() does not set default credentials, allowing gRPC to configure its own credentials without being overridden by REST defaults. Additionally, it updates signing methods to handle missing unified credentials and adds comprehensive unit tests. The review feedback highlights style guide violations regarding type deduction: 'auto const' should be qualified as a reference ('auto const&') to prevent unnecessary copies of UnifiedCredentialsOption, and 'auto' should be replaced with the explicit 'StatusOrstd::string' type to avoid obscuring the return type.

Comment thread google/cloud/storage/client.cc Outdated
auto credentials = WrapRestCredentials(rest_internal::MapCredentials(
*connection_->options().get<UnifiedCredentialsOption>()));
// gRPC clients using `GrpcCredentialOption` have no unified credentials.
auto const unified = connection_->options().get<UnifiedCredentialsOption>();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

According to the repository style guide, auto should be explicitly qualified with const and reference (&) to prevent unintended copies of non-fundamental types. Since UnifiedCredentialsOption holds a std::shared_ptr, using auto const& avoids an unnecessary copy and the associated atomic reference-counting overhead.

  auto const& unified = connection_->options().get<UnifiedCredentialsOption>();
References
  1. Ensure auto is explicitly qualified with const, reference (&), or pointer () (e.g., auto const&, auto&, auto) to prevent unintended copies or ambiguous mutability. (link)
  2. When a function returns a reference to a container or a large object (such as std::multimap), use 'auto const&' instead of 'auto' to avoid unnecessary and inefficient copies.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This line was removed when the PR was rescoped to the REST emulator fix, so URL signing is now unchanged from main. For the record: StorageConnection::options() returns Options by value, so binding auto const& to options().get<...>() would leave a dangling reference (ASan reports a heap-use-after-free); the by-value copy was intentional.

Comment thread google/cloud/storage/client.cc Outdated
return SignBlobResponseRaw{credentials.KeyId(), *std::move(signed_blob)};
// First try to sign locally. gRPC clients using `GrpcCredentialOption` have
// no unified credentials, and can only sign using the API.
auto const unified = connection_->options().get<UnifiedCredentialsOption>();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

According to the repository style guide, auto should be explicitly qualified with const and reference (&) to prevent unintended copies of non-fundamental types. Since UnifiedCredentialsOption holds a std::shared_ptr, using auto const& avoids an unnecessary copy and the associated atomic reference-counting overhead.

  auto const& unified = connection_->options().get<UnifiedCredentialsOption>();
References
  1. Ensure auto is explicitly qualified with const, reference (&), or pointer () (e.g., auto const&, auto&, auto) to prevent unintended copies or ambiguous mutability. (link)
  2. When a function returns a reference to a container or a large object (such as std::multimap), use 'auto const&' instead of 'auto' to avoid unnecessary and inefficient copies.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This line was removed when the PR was rescoped to the REST emulator fix, so URL signing is now unchanged from main. For the record: StorageConnection::options() returns Options by value, so binding auto const& to options().get<...>() would leave a dangling reference (ASan reports a heap-use-after-free); the by-value copy was intentional.

Comment thread google/cloud/storage/client.cc Outdated
if (unified) {
auto credentials =
WrapRestCredentials(rest_internal::MapCredentials(*unified));
auto signed_blob = credentials.SignBlob(signing_account, string_to_sign);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

According to the repository style guide, auto should not be used when it hides StatusOr<T> return types. Explicitly declaring the type as StatusOr<std::string> improves readability and adheres to the style guide.

    StatusOr<std::string> signed_blob = credentials.SignBlob(signing_account, string_to_sign);
References
  1. Flag and reject auto when it hides StatusOr, domain objects, protobuf messages/fields, or function return types. (link)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This line was removed when the PR was rescoped to the REST emulator fix, so URL signing is now unchanged from main. For the record: WrapRestCredentials::SignBlob() returns StatusOr<std::vector<std::uint8_t>>, so StatusOr<std::string> would not compile, and this line was existing code that had only moved.

@codecov

codecov Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.75%. Comparing base (1ff1740) to head (aed8a43).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16687      +/-   ##
==========================================
+ Coverage   92.73%   92.75%   +0.01%     
==========================================
  Files        2271     2271              
  Lines      226963   227072     +109     
==========================================
+ Hits       210476   210622     +146     
+ Misses      16487    16450      -37     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

copybara-service Bot pushed a commit to google/array_record that referenced this pull request Nov 19, 2026
…el 8.

The new riegeli release on BCR adds `Reader::NewReader(initial_pos, length_hint)`,
which upcoming ArrayRecord changes use for bounded GCS reads. Moving to it needs
several OSS build changes at once:

*   The other direct dependencies in `MODULE.bazel` are raised to the versions
    riegeli requires (abseil-cpp, protobuf, rules_cc, rules_python, platforms,
    googletest, pybind11_bazel). The build sets
    `--check_direct_dependencies=error`, so they must match.
*   CI and the BCR presubmit move from Bazel 7 to Bazel 8: rules_python 2.4.1
    does not load on Bazel 7.
*   Linux wheels are built on `manylinux_2_28` instead of `manylinux2014`,
    because Bazel 8 needs a newer libstdc++ than the manylinux2014 image has.
    Prebuilt Linux wheels now need glibc 2.28 or newer, so CentOS/RHEL 7,
    Amazon Linux 2, and Ubuntu 18.04 lose them. manylinux2014 is end-of-life
    together with CentOS 7.
*   `SequencedChunkWriter` pads with `WritePadding(kImplicitPadding)` in OSS
    too, since the new riegeli removed `PadToBlockBoundary()`.
*   macOS CI moves from `macos-14`, which GitHub Actions no longer runs for
    this repository, to `macos-15`. `pypa/gh-action-pypi-publish` is pinned to
    v1.14.3, which fixes GHSA-5xjx-3w67-w9x9.

`ArrayRecordReader` now uses insecure credentials for `gs://` paths when
`CLOUD_STORAGE_EMULATOR_ENDPOINT` is set. google-cloud-cpp 3.x documents this
for `storage::Client()`, but its default options replace these credentials with
Application Default Credentials. Outside of GCE those look up the metadata
server, and the read is retried until the retry policy expires. With the new
google-cloud-cpp, this made the GCS emulator tests in `array_record_module_test`
time out. This workaround can be removed once
googleapis/google-cloud-cpp#16678 is fixed (proposed
fix: googleapis/google-cloud-cpp#16687) and the OSS
build uses a google-cloud-cpp release with it.
PiperOrigin-RevId: 1025490093
Since v3.0.0, `storage::Client()` ignores `CLOUD_STORAGE_EMULATOR_ENDPOINT`
when choosing credentials. `DefaultOptionsWithCredentials()` still built
insecure credentials for the emulator, but passed them to a
`DefaultOptions()` overload that discarded them, and `DefaultOptions()` then
set Application Default Credentials. Off GCE every request retried the
metadata server lookup until the retry policy expired.

`DefaultOptionsWithCredentials()` now sets `UnifiedCredentialsOption` itself:
insecure credentials for the emulator, otherwise Application Default
Credentials built with `MakeAuthOptions()`, so token requests keep the
client's tracing and logging settings again. `DefaultOptions()` no longer sets
credentials, and the unused overload is removed.

gRPC clients now call `DefaultOptions()` and keep using Application Default
Credentials unless `UnifiedCredentialsOption` is set, as before. The REST
emulator endpoint does not change their credentials.

Fixes googleapis#16678
copybara-service Bot pushed a commit to google/array_record that referenced this pull request Nov 19, 2026
…el 8.

The new riegeli release on BCR adds `Reader::NewReader(initial_pos, length_hint)`,
which upcoming ArrayRecord changes use for bounded GCS reads. Moving to it needs
several OSS build changes at once:

*   The other direct dependencies in `MODULE.bazel` are raised to the versions
    riegeli requires (abseil-cpp, protobuf, rules_cc, rules_python, platforms,
    googletest, pybind11_bazel). The build sets
    `--check_direct_dependencies=error`, so they must match.
*   CI and the BCR presubmit move from Bazel 7 to Bazel 8: rules_python 2.4.1
    does not load on Bazel 7.
*   Linux wheels are built on `manylinux_2_28` instead of `manylinux2014`,
    because Bazel 8 needs a newer libstdc++ than the manylinux2014 image has.
    Prebuilt Linux wheels now need glibc 2.28 or newer, so CentOS/RHEL 7,
    Amazon Linux 2, and Ubuntu 18.04 lose them. manylinux2014 is end-of-life
    together with CentOS 7.
*   `SequencedChunkWriter` pads with `WritePadding(kImplicitPadding)` in OSS
    too, since the new riegeli removed `PadToBlockBoundary()`.
*   macOS CI moves from `macos-14`, which GitHub Actions no longer runs for
    this repository, to `macos-15`. `pypa/gh-action-pypi-publish` is pinned to
    v1.14.3, which fixes GHSA-5xjx-3w67-w9x9.
*   The wheel build skips the `*.venv` directories rules_python 2.x creates
    for `py_test` targets. Their `python3` symlink does not resolve outside of
    runfiles, and the macOS `rsync -L` fails on it.

`ArrayRecordReader` now uses insecure credentials for `gs://` paths when
`CLOUD_STORAGE_EMULATOR_ENDPOINT` is set. google-cloud-cpp 3.x documents this
for `storage::Client()`, but its default options replace these credentials with
Application Default Credentials. Outside of GCE those look up the metadata
server, and the read is retried until the retry policy expires. With the new
google-cloud-cpp, this made the GCS emulator tests in `array_record_module_test`
time out. This workaround can be removed once
googleapis/google-cloud-cpp#16678 is fixed (proposed
fix: googleapis/google-cloud-cpp#16687) and the OSS
build uses a google-cloud-cpp release with it.
PiperOrigin-RevId: 1025490093
@zhixiangli
zhixiangli force-pushed the fix-storage-emulator-credentials branch from fc10cfc to 3371fd3 Compare November 19, 2026 16:13
copybara-service Bot pushed a commit to google/array_record that referenced this pull request Nov 19, 2026
…el 8.

The new riegeli release on BCR adds `Reader::NewReader(initial_pos, length_hint)`,
which upcoming ArrayRecord changes use for bounded GCS reads. Moving to it needs
several OSS build changes at once:

*   The other direct dependencies in `MODULE.bazel` are raised to the versions
    riegeli requires (abseil-cpp, protobuf, rules_cc, rules_python, platforms,
    googletest, pybind11_bazel). The build sets
    `--check_direct_dependencies=error`, so they must match.
*   CI and the BCR presubmit move from Bazel 7 to Bazel 8: rules_python 2.4.1
    does not load on Bazel 7.
*   Linux wheels are built on `manylinux_2_28` instead of `manylinux2014`,
    because Bazel 8 needs a newer libstdc++ than the manylinux2014 image has.
    Prebuilt Linux wheels now need glibc 2.28 or newer, so CentOS/RHEL 7,
    Amazon Linux 2, and Ubuntu 18.04 lose them. manylinux2014 is end-of-life
    together with CentOS 7.
*   `SequencedChunkWriter` pads with `WritePadding(kImplicitPadding)` in OSS
    too, since the new riegeli removed `PadToBlockBoundary()`.
*   macOS CI moves from `macos-14`, which GitHub Actions no longer runs for
    this repository, to `macos-15`. `pypa/gh-action-pypi-publish` is pinned to
    v1.14.3, which fixes GHSA-5xjx-3w67-w9x9.
*   The wheel build skips the `*.venv` directories rules_python 2.x creates
    for `py_test` targets. Their `python3` symlink does not resolve outside of
    runfiles, and the macOS `rsync -L` fails on it.

`ArrayRecordReader` now uses insecure credentials for `gs://` paths when
`CLOUD_STORAGE_EMULATOR_ENDPOINT` is set. google-cloud-cpp 3.x documents this
for `storage::Client()`, but its default options replace these credentials with
Application Default Credentials. Outside of GCE those look up the metadata
server, and the read is retried until the retry policy expires. With the new
google-cloud-cpp, this made the GCS emulator tests in `array_record_module_test`
time out. This workaround can be removed once
googleapis/google-cloud-cpp#16678 is fixed (proposed
fix: googleapis/google-cloud-cpp#16687) and the OSS
build uses a google-cloud-cpp release with it.
PiperOrigin-RevId: 1025490093
@zhixiangli
zhixiangli marked this pull request as ready for review November 19, 2026 23:42
@zhixiangli
zhixiangli requested review from a team as code owners November 19, 2026 23:42
`DefaultOptionsWithCredentials()` and `DefaultOptionsGrpc()` built the
auth options for the default credentials after `DefaultOptions()` added
the `CLOUD_STORAGE_ENABLE_TRACING` components. With
`CLOUD_STORAGE_ENABLE_TRACING=http` the logs then included the OAuth
token requests, including the refresh token. Any value also replaced the
`GOOGLE_CLOUD_CPP_ENABLE_TRACING` components that the credentials use,
which disabled `auth` logging.

Capture the auth options before `DefaultOptions()`, as 2.x did. Logging
and tracing options set in code still reach the credentials.

In the new tests, spell out the deduced types, and replace test helpers
that return a named local: gcov reports their closing brace as never
executed.

Refs: googleapis#16678
`CLOUD_STORAGE_EMULATOR_ENDPOINT` also makes `storage::Client` use
insecure credentials, unless the application sets
`UnifiedCredentialsOption`. The variable does not change the gRPC
endpoint or credentials of `MakeGrpcClient()` or `AsyncClient`.

Refs: googleapis#16678
copybara-service Bot pushed a commit to google/array_record that referenced this pull request Nov 20, 2026
…el 8.

The new riegeli release on BCR adds `Reader::NewReader(initial_pos, length_hint)`,
which upcoming ArrayRecord changes use for bounded GCS reads. Moving to it needs
several OSS build changes at once:

*   The other direct dependencies in `MODULE.bazel` are raised to the versions
    riegeli requires (abseil-cpp, protobuf, rules_cc, rules_python, platforms,
    googletest, pybind11_bazel). The build sets
    `--check_direct_dependencies=error`, so they must match.
*   CI and the BCR presubmit move from Bazel 7 to Bazel 8: rules_python 2.4.1
    does not load on Bazel 7.
*   Linux wheels are built on `manylinux_2_28` instead of `manylinux2014`,
    because Bazel 8 needs a newer libstdc++ than the manylinux2014 image has.
    Prebuilt Linux wheels now need glibc 2.28 or newer, so CentOS/RHEL 7,
    Amazon Linux 2, and Ubuntu 18.04 lose them. manylinux2014 is end-of-life
    together with CentOS 7.
*   `SequencedChunkWriter` pads with `WritePadding(kImplicitPadding)` in OSS
    too, since the new riegeli removed `PadToBlockBoundary()`.
*   macOS CI moves from `macos-14`, which GitHub Actions no longer runs for
    this repository, to `macos-15`. `pypa/gh-action-pypi-publish` is pinned to
    v1.14.3, which fixes GHSA-5xjx-3w67-w9x9.
*   The wheel build skips the `*.venv` directories rules_python 2.x creates
    for `py_test` targets. Their `python3` symlink does not resolve outside of
    runfiles, and the macOS `rsync -L` fails on it.

`ArrayRecordReader` now uses insecure credentials for `gs://` paths when
`CLOUD_STORAGE_EMULATOR_ENDPOINT` is set. google-cloud-cpp 3.x documents this
for `storage::Client()`, but its default options replace these credentials with
Application Default Credentials. Outside of GCE those look up the metadata
server, and the read is retried until the retry policy expires. With the new
google-cloud-cpp, this made the GCS emulator tests in `array_record_module_test`
time out. This workaround can be removed once
googleapis/google-cloud-cpp#16678 is fixed (proposed
fix: googleapis/google-cloud-cpp#16687) and the OSS
build uses a google-cloud-cpp release with it.
PiperOrigin-RevId: 1025490093
copybara-service Bot pushed a commit to google/array_record that referenced this pull request Nov 20, 2026
…el 8.

The new riegeli release on BCR adds `Reader::NewReader(initial_pos, length_hint)`,
which upcoming ArrayRecord changes use for bounded GCS reads. Moving to it needs
several OSS build changes at once:

*   The other direct dependencies in `MODULE.bazel` are raised to the versions
    riegeli requires (abseil-cpp, protobuf, rules_cc, rules_python, platforms,
    googletest, pybind11_bazel). The build sets
    `--check_direct_dependencies=error`, so they must match.
*   CI and the BCR presubmit move from Bazel 7 to Bazel 8: rules_python 2.4.1
    does not load on Bazel 7.
*   Linux wheels are built on `manylinux_2_28` instead of `manylinux2014`,
    because Bazel 8 needs a newer libstdc++ than the manylinux2014 image has.
    Prebuilt Linux wheels now need glibc 2.28 or newer, so CentOS/RHEL 7,
    Amazon Linux 2, and Ubuntu 18.04 lose them. manylinux2014 is end-of-life
    together with CentOS 7.
*   `SequencedChunkWriter` pads with `WritePadding(kImplicitPadding)` in OSS
    too, since the new riegeli removed `PadToBlockBoundary()`.
*   macOS CI moves from `macos-14`, which GitHub Actions no longer runs for
    this repository, to `macos-15`. `pypa/gh-action-pypi-publish` is pinned to
    v1.14.3, which fixes GHSA-5xjx-3w67-w9x9.
*   The wheel build skips the `*.venv` directories rules_python 2.x creates
    for `py_test` targets. Their `python3` symlink does not resolve outside of
    runfiles, and the macOS `rsync -L` fails on it.

`ArrayRecordReader` now uses insecure credentials for `gs://` paths when
`CLOUD_STORAGE_EMULATOR_ENDPOINT` is set. google-cloud-cpp 3.x documents this
for `storage::Client()`, but its default options replace these credentials with
Application Default Credentials. Outside of GCE those look up the metadata
server, and the read is retried until the retry policy expires. With the new
google-cloud-cpp, this made the GCS emulator tests in `array_record_module_test`
time out. This workaround can be removed once
googleapis/google-cloud-cpp#16678 is fixed (proposed
fix: googleapis/google-cloud-cpp#16687) and the OSS
build uses a google-cloud-cpp release with it.
PiperOrigin-RevId: 1025490093
copybara-service Bot pushed a commit to google/array_record that referenced this pull request Nov 20, 2026
…el 8.

The new riegeli release on BCR adds `Reader::NewReader(initial_pos, length_hint)`,
which upcoming ArrayRecord changes use for bounded GCS reads. Moving to it needs
several OSS build changes at once:

*   The other direct dependencies in `MODULE.bazel` are raised to the versions
    riegeli requires (abseil-cpp, protobuf, rules_cc, rules_python, platforms,
    googletest, pybind11_bazel). The build sets
    `--check_direct_dependencies=error`, so they must match.
*   CI and the BCR presubmit move from Bazel 7 to Bazel 8: rules_python 2.4.1
    does not load on Bazel 7.
*   Linux wheels are built on `manylinux_2_28` instead of `manylinux2014`,
    because Bazel 8 needs a newer libstdc++ than the manylinux2014 image has.
    Prebuilt Linux wheels now need glibc 2.28 or newer, so CentOS/RHEL 7,
    Amazon Linux 2, and Ubuntu 18.04 lose them. manylinux2014 is end-of-life
    together with CentOS 7.
*   `SequencedChunkWriter` pads with `WritePadding(kImplicitPadding)` in OSS
    too, since the new riegeli removed `PadToBlockBoundary()`.
*   macOS CI moves from `macos-14`, which GitHub Actions no longer runs for
    this repository, to `macos-15`. `pypa/gh-action-pypi-publish` is pinned to
    v1.14.3, which fixes GHSA-5xjx-3w67-w9x9.
*   The wheel build skips the `*.venv` directories rules_python 2.x creates
    for `py_test` targets. Their `python3` symlink does not resolve outside of
    runfiles, and the macOS `rsync -L` fails on it.

`ArrayRecordReader` now uses insecure credentials for `gs://` paths when
`CLOUD_STORAGE_EMULATOR_ENDPOINT` is set. google-cloud-cpp 3.x documents this
for `storage::Client()`, but its default options replace these credentials with
Application Default Credentials. Outside of GCE those look up the metadata
server, and the read is retried until the retry policy expires. With the new
google-cloud-cpp, this made the GCS emulator tests in `array_record_module_test`
time out. This workaround can be removed once
googleapis/google-cloud-cpp#16678 is fixed (proposed
fix: googleapis/google-cloud-cpp#16687) and the OSS
build uses a google-cloud-cpp release with it.
PiperOrigin-RevId: 1025490093
copybara-service Bot pushed a commit to google/array_record that referenced this pull request Nov 20, 2026
…el 8.

The new riegeli release on BCR adds `Reader::NewReader(initial_pos, length_hint)`,
which upcoming ArrayRecord changes use for bounded GCS reads. Moving to it needs
several OSS build changes at once:

*   The other direct dependencies in `MODULE.bazel` are raised to the versions
    riegeli requires (abseil-cpp, protobuf, rules_cc, rules_python, platforms,
    googletest, pybind11_bazel). The build sets
    `--check_direct_dependencies=error`, so they must match.
*   CI and the BCR presubmit move from Bazel 7 to Bazel 8: rules_python 2.4.1
    does not load on Bazel 7.
*   Linux wheels are built on `manylinux_2_28` instead of `manylinux2014`,
    because Bazel 8 needs a newer libstdc++ than the manylinux2014 image has.
    Prebuilt Linux wheels now need glibc 2.28 or newer, so CentOS/RHEL 7,
    Amazon Linux 2, and Ubuntu 18.04 lose them. manylinux2014 is end-of-life
    together with CentOS 7.
*   `SequencedChunkWriter` pads with `WritePadding(kImplicitPadding)` in OSS
    too, since the new riegeli removed `PadToBlockBoundary()`.
*   macOS CI moves from `macos-14`, which GitHub Actions no longer runs for
    this repository, to `macos-15`. `pypa/gh-action-pypi-publish` is pinned to
    v1.14.3, which fixes GHSA-5xjx-3w67-w9x9.
*   The wheel build skips the `*.venv` directories rules_python 2.x creates
    for `py_test` targets. Their `python3` symlink does not resolve outside of
    runfiles, and the macOS `rsync -L` fails on it.

`ArrayRecordReader` now uses insecure credentials for `gs://` paths when
`CLOUD_STORAGE_EMULATOR_ENDPOINT` is set. google-cloud-cpp 3.x documents this
for `storage::Client()`, but its default options replace these credentials with
Application Default Credentials. Outside of GCE those look up the metadata
server, and the read is retried until the retry policy expires. With the new
google-cloud-cpp, this made the GCS emulator tests in `array_record_module_test`
time out. This workaround can be removed once
googleapis/google-cloud-cpp#16678 is fixed (proposed
fix: googleapis/google-cloud-cpp#16687) and the OSS
build uses a google-cloud-cpp release with it.
PiperOrigin-RevId: 1025490093
// `CLOUD_STORAGE_ENABLE_TRACING`. Those configure the storage client only:
// `http` would log the OAuth token requests, and any value would replace the
// `GOOGLE_CLOUD_CPP_ENABLE_TRACING` components used by the credentials.
auto auth_options = google::cloud::internal::MakeAuthOptions(opts);

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.

Calling MakeAuthOptions(opts) before DefaultOptions() prevents GOOGLE_CLOUD_CPP_OPENTELEMETRY_TRACING from reaching the default credentials. Unlike LoggingComponentsOption, PopulateAuthOptions() does not read GOOGLE_CLOUD_CPP_OPENTELEMETRY_TRACING, so OAuth token requests lose OpenTelemetry spans unless OpenTelemetryTracingOption is set in code.

Consider copying OpenTelemetryTracingOption from opts into auth_options after DefaultOptions() runs in both DefaultOptionsWithCredentials() and DefaultOptionsGrpc(), with a unit test covering that env var.


/// @test Verify `CLOUD_STORAGE_ENABLE_TRACING` configures the client logging
/// only. The default credentials use `GOOGLE_CLOUD_CPP_ENABLE_TRACING`.
TEST(DefaultOptionsGrpc, DefaultCredentialsIgnoreStorageTracingEnvironment) {

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.

DefaultCredentialsIgnoreStorageTracingEnvironment passes empty Options{} with GOOGLE_CLOUD_CPP_ENABLE_TRACING=auth, which PopulateAuthOptions() already applies even when MakeGoogleDefaultCredentials() receives empty options. As a result, no test in this file fails if DefaultOptionsGrpc() drops auth_options on line 95.

// endpoint does not change the gRPC credentials. As in
// `DefaultOptionsWithCredentials()`, capture the auth options before
// `DefaultOptions()` adds the `CLOUD_STORAGE_ENABLE_TRACING` components.
auto auth_options = google::cloud::internal::MakeAuthOptions(options);

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.

Per the repository style guide, auto auth_options hides the function return type Options and lacks an explicit qualifier.

copybara-service Bot pushed a commit to google/array_record that referenced this pull request Nov 20, 2026
…el 8.

The new riegeli release on BCR adds `Reader::NewReader(initial_pos, length_hint)`,
which upcoming ArrayRecord changes use for bounded GCS reads. Moving to it needs
several OSS build changes at once:

*   The other direct dependencies in `MODULE.bazel` are raised to the versions
    riegeli requires (abseil-cpp, protobuf, rules_cc, rules_python, platforms,
    googletest, pybind11_bazel). The build sets
    `--check_direct_dependencies=error`, so they must match.
*   CI and the BCR presubmit move from Bazel 7 to Bazel 8: rules_python 2.4.1
    does not load on Bazel 7.
*   Linux wheels are built on `manylinux_2_28` instead of `manylinux2014`,
    because Bazel 8 needs a newer libstdc++ than the manylinux2014 image has.
    Prebuilt Linux wheels now need glibc 2.28 or newer, so CentOS/RHEL 7,
    Amazon Linux 2, and Ubuntu 18.04 lose them. manylinux2014 is end-of-life
    together with CentOS 7.
*   `SequencedChunkWriter` pads with `WritePadding(kImplicitPadding)` in OSS
    too, since the new riegeli removed `PadToBlockBoundary()`.
*   macOS CI moves from `macos-14`, which GitHub Actions no longer runs for
    this repository, to `macos-15`. `pypa/gh-action-pypi-publish` is pinned to
    v1.14.3, which fixes GHSA-5xjx-3w67-w9x9.
*   The wheel build skips the `*.venv` directories rules_python 2.x creates
    for `py_test` targets. Their `python3` symlink does not resolve outside of
    runfiles, and the macOS `rsync -L` fails on it.

`ArrayRecordReader` now uses insecure credentials for `gs://` paths when
`CLOUD_STORAGE_EMULATOR_ENDPOINT` is set. google-cloud-cpp 3.x documents this
for `storage::Client()`, but its default options replace these credentials with
Application Default Credentials. Outside of GCE those look up the metadata
server, and the read is retried until the retry policy expires. With the new
google-cloud-cpp, this made the GCS emulator tests in `array_record_module_test`
time out. This workaround can be removed once
googleapis/google-cloud-cpp#16678 is fixed (proposed
fix: googleapis/google-cloud-cpp#16687) and the OSS
build uses a google-cloud-cpp release with it.
PiperOrigin-RevId: 1025490093
copybara-service Bot pushed a commit to google/array_record that referenced this pull request Nov 20, 2026
…el 8.

The new riegeli release on BCR adds `Reader::NewReader(initial_pos, length_hint)`,
which upcoming ArrayRecord changes use for bounded GCS reads. Moving to it needs
several OSS build changes at once:

*   The other direct dependencies in `MODULE.bazel` are raised to the versions
    riegeli requires (abseil-cpp, protobuf, rules_cc, rules_python, platforms,
    googletest, pybind11_bazel). The build sets
    `--check_direct_dependencies=error`, so they must match.
*   CI and the BCR presubmit move from Bazel 7 to Bazel 8: rules_python 2.4.1
    does not load on Bazel 7.
*   Linux wheels are built on `manylinux_2_28` instead of `manylinux2014`,
    because Bazel 8 needs a newer libstdc++ than the manylinux2014 image has.
    Prebuilt Linux wheels now need glibc 2.28 or newer, so CentOS/RHEL 7,
    Amazon Linux 2, and Ubuntu 18.04 lose them. manylinux2014 is end-of-life
    together with CentOS 7.
*   `SequencedChunkWriter` pads with `WritePadding(kImplicitPadding)` in OSS
    too, since the new riegeli removed `PadToBlockBoundary()`.
*   macOS CI moves from `macos-14`, which GitHub Actions no longer runs for
    this repository, to `macos-15`. `pypa/gh-action-pypi-publish` is pinned to
    v1.14.3, which fixes GHSA-5xjx-3w67-w9x9.
*   The wheel build skips the `*.venv` directories rules_python 2.x creates
    for `py_test` targets. Their `python3` symlink does not resolve outside of
    runfiles, and the macOS `rsync -L` fails on it.

`ArrayRecordReader` now uses insecure credentials for `gs://` paths when
`CLOUD_STORAGE_EMULATOR_ENDPOINT` is set. google-cloud-cpp 3.x documents this
for `storage::Client()`, but its default options replace these credentials with
Application Default Credentials. Outside of GCE those look up the metadata
server, and the read is retried until the retry policy expires. With the new
google-cloud-cpp, this made the GCS emulator tests in `array_record_module_test`
time out. This workaround can be removed once
googleapis/google-cloud-cpp#16678 is fixed (proposed
fix: googleapis/google-cloud-cpp#16687) and the OSS
build uses a google-cloud-cpp release with it.
PiperOrigin-RevId: 1026386371

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

api: storage Issues related to the Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

storage: CLOUD_STORAGE_EMULATOR_ENDPOINT no longer implies insecure credentials; client uses ADC and can hang for 15 minutes off-GCP (3.x regression)

2 participants