Xuanwo opened a new pull request, #8903:
URL: https://github.com/apache/opendal/pull/8903
# Which issue does this PR close?
Closes #8875.
# Rationale for this change
`azblob` had two presigning bugs:
1. `AzblobBackend::presign` ignored `args.expire()` and
`AzblobCore::sign_query` hardcoded a 3600-second expiration.
2. `AzblobBuilder::build` already configured
`RequestSigner::new().with_service_sas_permissions("racwd")`, but gated
`capability.presign`, `presign_stat`, `presign_read`, and `presign_write`
solely on `self.config.sas_token.is_some()`, rejecting SharedKey Service SAS
presign calls with `Unsupported`.
In addition, credential configuration had drifted across `azblob`, `azdls`,
and `azfile`:
- `azblob` and `azfile` did not expose or wire `client_id`, `client_secret`,
`tenant_id`, and `authority_host` into `ClientSecretCredentialProvider`, unlike
`azdls` and `azure-common::AzureStorageConfig`.
- `azfile` lacked `sas_token` builder support, `credential_provider_chain`,
`reqsign_azure_storage` re-export, and `skip_signature`, and unconditionally
rejected missing `account_name` during `build()` even when authenticating with
a SAS token, custom credential chain, Entra ID, or `skip_signature`.
# What changes are included in this PR?
- **`azblob` presign fixes**:
- Updated `AzblobCore::sign_query` to accept `duration: Duration` and
forwarded `args.expire()` from `AzblobBackend::presign` (retaining
`Duration::from_secs(3600)` for internal `PutBlockFromUrl` source URL signing).
- Updated `capability.presign`, `presign_stat`, `presign_read`, and
`presign_write` in `AzblobBuilder::build` to be enabled when `skip_signature`
is false and SharedKey (`account_name` + `account_key`), a non-empty
`sas_token`, or a custom `credential_provider_chain` is configured, while
keeping presign disabled for Entra ID client credentials alone (User Delegation
SAS is tracked separately in #8104).
- Added the corresponding `can_presign` capability documentation mapping
in `dev/src/generate/capabilities_docs.rs`.
- **Azure credential parity across `azblob` and `azfile`**:
- Added `client_id`, `client_secret`, `tenant_id`, and `authority_host`
config fields, builder methods, `From<AzureStorageConfig>` mappings, and
`ClientSecretCredentialProvider` wiring in `azblob` and `azfile` matching
`azdls`.
- Added `sas_token`, `credential_provider_chain`, `skip_signature`, and
`pub use reqsign_azure_storage;` to `azfile`.
- Stopped unconditionally requiring `account_name` in
`AzfileBuilder::build()`, matching `azblob` and `azdls`, and suppressed
`sas_token` propagation into rename source URLs when
`credential_provider_chain` or `skip_signature` is set.
- **Generated bindings & docs**:
- Regenerated Python, Java, .NET config bindings and website
service/capability metadata via `odev generate`.
- **Unit tests**:
- Added isolated deterministic unit tests (using `StaticEnv` and mock
`HttpSend`) for `azblob` presign expiration forwarding, SharedKey Service SAS
capability/signing, Entra ID capability boundary, and
`ClientSecretCredentialProvider` wiring, as well as `azfile` SAS without
`account_name`, `skip_signature`, `credential_provider_chain`, and
`ClientSecretCredentialProvider` wiring.
# Are there any user-facing changes?
- `azblob` presign operations now honor the requested expiration duration
and work with SharedKey (`account_name` + `account_key`) and custom
`credential_provider_chain` configurations.
- `azblob` and `azfile` now accept `client_id`, `client_secret`,
`tenant_id`, and `authority_host` for Microsoft Entra ID service principal
authentication.
- `azfile` now supports `sas_token`, `credential_provider_chain`,
`skip_signature`, and building without `account_name` when not using SharedKey
authentication.
# Breaking changes
# AI Usage Statement
- Harness: pi
- Model: Gemini 4 Neon
- Effort: High
- Role: Implemented the `azblob` presign fixes and `azblob`/`azfile`
credential wiring parity, added deterministic unit tests, updated capability
doc extraction, and regenerated binding/website config files. Local
verification covered unit tests, doc tests, clippy, rustdoc, wasm32
compilation, and codegen determinism; real Azure Storage and Azurite behavior
tests have not been executed locally and rely on CI (note that Azurite
path-style endpoints with `reqsign-azure-storage` 3.3.1 Service SAS signing
should be observed on CI's `azurite_azblob` job).
--
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]