Xuanwo opened a new pull request, #8901: URL: https://github.com/apache/opendal/pull/8901
# Which issue does this PR close? Closes #8874. # Rationale for this change Both `opendal-service-gcs` and `opendal-service-gcs-grpc` had two issues in credential chain construction: 1. Invalid base64 (or non-UTF-8 decoded) `credential` values were silently ignored via `if let Ok(provider) = StaticCredentialProvider::from_base64(content)`, causing `Builder::build()` to fall back to ADC or VM metadata credentials instead of failing with `ErrorKind::ConfigInvalid`. 2. Both builders snapshotted the process environment into `StaticEnv` solely to inject `GOOGLE_SCOPE`, and disabled `DefaultCredentialProvider`'s VM metadata slot only to push a separate `VmMetadataCredentialProvider` when `service_account` was set. # What changes are included in this PR? - Return `ErrorKind::ConfigInvalid` with the underlying decode error as source when `config.credential` fails `StaticCredentialProvider::from_base64` in both `GcsBuilder` and `GcsGrpcBuilder`. - Replace the `StaticEnv` `GOOGLE_SCOPE` snapshot with `OsEnv` and configure `EnvCredentialProvider`, `WellKnownCredentialProvider`, and `VmMetadataCredentialProvider` with `.with_scope(&scope)` (and `.with_service_account(sa)` when set) directly on `DefaultCredentialProvider::builder()`. - Add unit tests in `core/services/gcs/src/backend.rs` and `core/services/gcs-grpc/src/backend.rs` covering invalid base64 / non-UTF-8 `credential` rejection, typed `scope` and `service_account` wiring without `StaticEnv` scope injection, and `disable_config_load` / `disable_vm_metadata` behavior. # Are there any user-facing changes? Invalid `credential` values configured on `GcsBuilder` or `GcsGrpcBuilder` now fail eagerly at `Builder::build()` with `ErrorKind::ConfigInvalid` instead of being silently ignored and falling back to ambient credentials. # Breaking changes # AI Usage Statement - Harness: pi - Model: Gemini 4 Neon - Effort: High - Role: Implemented the builder fixes and unit tests for `opendal-service-gcs` and `opendal-service-gcs-grpc`, and drafted this PR description. Verification covered unit tests, clippy, formatting, and rustdoc; live GCS integration tests were not executed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
