Xuanwo opened a new pull request, #8904:
URL: https://github.com/apache/opendal/pull/8904
# Which issue does this PR close?
Closes #8877.
# Rationale for this change
`core/services/obs` still assembled its credential chain by hand from
`EnvCredentialProvider` and could not express temporary credentials. That
left
OBS behind `s3`, `oss`, `cos`, and `tos`, which all load credentials through
the
service crate's `DefaultCredentialProvider` and expose `security_token`,
`disable_config_load`, and `skip_signature`.
Pinning credentials in a deployment also needs a way to stop OpenDAL from
silently picking up ambient `HUAWEI_CLOUD_*` credentials, and unauthenticated
access to a private OBS deployment needs a way to skip signing entirely.
# What changes are included in this PR?
- Build the OBS credential chain with
`reqsign_huaweicloud_obs::DefaultCredentialProvider::builder()`. Static
credentials configured on the builder are still pushed to the front of the
chain, so they keep precedence over the environment.
- Add `security_token` to `ObsConfig` and `ObsBuilder`. Static credentials
are
passed to `StaticCredentialProvider::with_security_token`, and the signer
attaches the token as `x-obs-security-token`.
- Add `disable_config_load`, which removes the environment slot with
`DefaultCredentialProvider::builder().no_env()`. Explicit static
credentials
keep working in that mode.
- Add `skip_signature`, which makes `ObsCore::sign` and `ObsCore::sign_query`
return the request unchanged, so neither credential loading nor signing
happens and presigned URLs come back unsigned.
- `ObsConfig`'s `Debug` output reports `security_token` as `<redacted>`,
matching
`CosConfig`.
- Add a "Credentials" section to the service docs describing the resolution
order.
- Regenerate the Python, Java, .NET, and website service configuration from
the
new public fields.
No `Cargo.toml` or `Cargo.lock` changes: this builds against
`reqsign-huaweicloud-obs` 3.0.8 as currently resolved. In that version
`security_token` is supported through the associated constructor
`StaticCredentialProvider::with_security_token(ak, sk, token)` rather than a
builder method, so the wiring uses that form.
Tests added in `core/services/obs/src/`:
- `security_token` is redacted in `ObsConfig`'s `Debug` output.
- The credential chain loads ambient credentials by default, ignores them
with
`disable_config_load`, and still uses explicit credentials in that mode.
- Signing with static credentials produces an `OBS <ak>:` authorization
header
and the `x-obs-security-token` header.
- `skip_signature` leaves header-signed and presigned requests unsigned, and
works when no credentials are available at all.
The tests use an isolated `reqsign_core::StaticEnv` and never mutate the
process
environment.
# Are there any user-facing changes?
Yes, three new options for the `obs` service, available in Rust and in the
generated Python, Java, and .NET service configs:
- `security_token` / `Obs::security_token`
- `disable_config_load` / `Obs::disable_config_load`
- `skip_signature` / `Obs::skip_signature`
Credential loading now goes through `DefaultCredentialProvider`. The
effective
resolution order stays "explicit static credentials, then
`HUAWEI_CLOUD_ACCESS_KEY_ID` / `HUAWEI_CLOUD_SECRET_ACCESS_KEY` /
`HUAWEI_CLOUD_SECURITY_TOKEN` from the environment".
# Breaking changes
# AI Usage Statement
- Harness: pi coding agent.
- Model: DeepSeek.
- Effort: default harness setting (not explicitly configured).
- Role: AI drafted and implemented the change, the unit tests, and the
regenerated binding configs under human direction. Unknowns that affect
review: the new behavior is verified with unit tests against
`reqsign-huaweicloud-obs` 3.0.8, not against a live OBS endpoint, so
`security_token` and `disable_config_load` have not been exercised against
a
real temporary-credential session. `skip_signature` is covered at the
signing
boundary rather than against a real anonymous-access endpoint.
--
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]