Skip to content

chore(storage): add DirectPath diagnostic info in gRPC request header#14126

Merged
cpriti-os merged 13 commits intogoogleapis:mainfrom
cpriti-os:fdp
Mar 11, 2026
Merged

chore(storage): add DirectPath diagnostic info in gRPC request header#14126
cpriti-os merged 13 commits intogoogleapis:mainfrom
cpriti-os:fdp

Conversation

@cpriti-os
Copy link
Copy Markdown
Contributor

No description provided.

@cpriti-os cpriti-os requested review from a team as code owners March 5, 2026 06:08
@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Mar 5, 2026
@cpriti-os cpriti-os marked this pull request as draft March 5, 2026 06:08
Copy link
Copy Markdown
Contributor

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

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 adds diagnostic information for DirectPath to the gRPC request headers, introducing a new mechanism to determine why DirectPath might not be used and report it. However, a security concern has been identified: a debug statement using fmt.Printf logs potentially sensitive request headers to stdout, which could lead to information disclosure in production environments. Additionally, the code has a few other issues: significant code duplication between GetDirectPathDiagnostic and directPathDiagnostic, inconsistent return values for diagnostic functions, and an opportunity to simplify error handling logic.

Comment thread storage/grpc_client.go Outdated
Comment thread storage/grpc_dp_diag.go Outdated
Comment thread storage/grpc_client.go Outdated
Comment thread storage/grpc_dp_diag.go Outdated
cpriti-os and others added 9 commits March 5, 2026 06:42
This refactors the auth diagnostic to use `internaloption.UnsafeResolver`
instead of `internal.DialSettings` and `internal.Creds()`, removing the
dependency on `google.golang.org/api/internal`. It now relies on the
`cloud.google.com/go/compute/metadata` package explicitly to verify
if a service account is attached and a token can be fetched.

It also upgrades `google.golang.org/api` to `main` to support the
latest methods added to `UnsafeResolver` and adds comprehensive unit tests
with a mocked metadata server for the diagnostic function.

Co-authored-by: cpriti-os <202586561+cpriti-os@users.noreply.github.com>
This refactors the auth diagnostic to use `internaloption.UnsafeResolver`
instead of `internal.DialSettings` and `internal.Creds()`, removing the
dependency on `google.golang.org/api/internal`. It now relies on the
`cloud.google.com/go/compute/metadata` package explicitly to verify
if a default service account is attached and a token can be fetched.

It removes outdated diagnostic reasons that relied on internal APIs
and adds `reasonCustomHTTPClient` and `reasonUndetermined`.

It also upgrades `google.golang.org/api` to `main` to support the
latest methods added to `UnsafeResolver` and adds comprehensive unit tests
with a mocked metadata server for the diagnostic function.

Co-authored-by: cpriti-os <202586561+cpriti-os@users.noreply.github.com>
@cpriti-os cpriti-os marked this pull request as ready for review March 10, 2026 09:53
@cpriti-os cpriti-os added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Mar 10, 2026
@cpriti-os cpriti-os removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Mar 11, 2026
Comment thread storage/grpc_dp_diag.go
Comment thread storage/grpc_dp_diag.go
Comment thread storage/grpc_dp_diag.go Outdated
Comment thread storage/grpc_dp_diag.go
@cpriti-os cpriti-os requested a review from krishnamd-jkp March 11, 2026 06:38
@cpriti-os cpriti-os merged commit a3fc221 into googleapis:main Mar 11, 2026
12 checks passed
@cpriti-os cpriti-os deleted the fdp branch March 12, 2026 13:00
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.

2 participants