You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2026/05/18 06:41:15 UTC
(opendal) branch main updated: feat(services/s3): Rename allow_anonymous to skip_signature (#7544)
This is an automated email from the ASF dual-hosted git repository.
Xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new b25d98f3b feat(services/s3): Rename allow_anonymous to skip_signature (#7544)
b25d98f3b is described below
commit b25d98f3b9df666eacd954d4b59cc9552e8af64b
Author: Yuang Gao <91...@users.noreply.github.com>
AuthorDate: Sun May 17 23:41:10 2026 -0700
feat(services/s3): Rename allow_anonymous to skip_signature (#7544)
* feat(services/s3): Rename allow_anonymous to skip_signature
* trigger CI
* fix(services/s3): Keep allow_anonymous as deprecated alias
---
.../OpenDAL/ServiceConfig/S3ServiceConfig.cs | 11 ++++++++++
.../java/org/apache/opendal/ServiceConfig.java | 9 ++++++++
bindings/python/python/opendal/operator.pyi | 16 +++++++++++++++
bindings/python/src/services.rs | 8 ++++++++
core/services/s3/src/backend.rs | 24 +++++++++++++++++-----
core/services/s3/src/config.rs | 6 ++++++
core/services/s3/src/core.rs | 11 ++++------
integrations/object_store/src/amazon_s3.rs | 2 +-
8 files changed, 74 insertions(+), 13 deletions(-)
diff --git a/bindings/dotnet/OpenDAL/ServiceConfig/S3ServiceConfig.cs b/bindings/dotnet/OpenDAL/ServiceConfig/S3ServiceConfig.cs
index 1ad0cf942..36d4666be 100644
--- a/bindings/dotnet/OpenDAL/ServiceConfig/S3ServiceConfig.cs
+++ b/bindings/dotnet/OpenDAL/ServiceConfig/S3ServiceConfig.cs
@@ -33,8 +33,13 @@ namespace OpenDAL.ServiceConfig
/// </summary>
public string? AccessKeyId { get; init; }
/// <summary>
+ /// Skip signature will skip loading credentials and signing requests.
+ /// </summary>
+ public bool? SkipSignature { get; init; }
+ /// <summary>
/// Allow anonymous will allow opendal to send request without signing when credential is not loaded.
/// </summary>
+ [System.Obsolete("Please use SkipSignature instead of AllowAnonymous")]
public bool? AllowAnonymous { get; init; }
/// <summary>
/// Set maximum batch operations of this backend. Some compatible services have a limit on the number of operations in a batch request. For example, R2 could return Internal Error while batch delete 1000 files. Please tune this value based on services' document.
@@ -154,10 +159,16 @@ namespace OpenDAL.ServiceConfig
{
map["access_key_id"] = Utilities.ToOptionString(AccessKeyId);
}
+ if (SkipSignature is not null)
+ {
+ map["skip_signature"] = Utilities.ToOptionString(SkipSignature);
+ }
+#pragma warning disable CS0618
if (AllowAnonymous is not null)
{
map["allow_anonymous"] = Utilities.ToOptionString(AllowAnonymous);
}
+#pragma warning restore CS0618
if (BatchMaxOperations is not null)
{
map["batch_max_operations"] = Utilities.ToOptionString(BatchMaxOperations);
diff --git a/bindings/java/src/main/java/org/apache/opendal/ServiceConfig.java b/bindings/java/src/main/java/org/apache/opendal/ServiceConfig.java
index d08e9300a..60c763bbc 100644
--- a/bindings/java/src/main/java/org/apache/opendal/ServiceConfig.java
+++ b/bindings/java/src/main/java/org/apache/opendal/ServiceConfig.java
@@ -2825,6 +2825,8 @@ public interface ServiceConfig {
/**
* <p>Allow anonymous will allow opendal to send request without signing
* when credential is not loaded.</p>
+ *
+ * @deprecated Please use `skip_signature` instead of `allow_anonymous`
*/
public final Boolean allowAnonymous;
/**
@@ -3045,6 +3047,10 @@ public interface ServiceConfig {
* by hand.</p>
*/
public final String sessionToken;
+ /**
+ * <p>Skip signature will skip loading credentials and signing requests.</p>
+ */
+ public final Boolean skipSignature;
@Override
public String scheme() {
@@ -3148,6 +3154,9 @@ public interface ServiceConfig {
if (sessionToken != null) {
map.put("session_token", sessionToken);
}
+ if (skipSignature != null) {
+ map.put("skip_signature", String.valueOf(skipSignature));
+ }
return map;
}
}
diff --git a/bindings/python/python/opendal/operator.pyi b/bindings/python/python/opendal/operator.pyi
index 2a35b53d8..d36612010 100644
--- a/bindings/python/python/opendal/operator.pyi
+++ b/bindings/python/python/opendal/operator.pyi
@@ -685,6 +685,7 @@ class AsyncOperator:
endpoint: builtins.str = ...,
root: builtins.str = ...,
sas_token: builtins.str = ...,
+ skip_signature: builtins.bool = ...,
) -> typing.Self:
r"""
Create a new `AsyncOperator` for `azblob` service.
@@ -717,6 +718,9 @@ class AsyncOperator:
All operations will happen under this root.
sas_token : builtins.str, optional
The sas token of Azblob service backend.
+ skip_signature : builtins.bool, optional
+ Skip signature will skip loading credentials and
+ signing requests.
Returns
-------
@@ -2126,6 +2130,7 @@ class AsyncOperator:
server_side_encryption_customer_key: builtins.str = ...,
server_side_encryption_customer_key_md5: builtins.str = ...,
session_token: builtins.str = ...,
+ skip_signature: builtins.bool = ...,
) -> typing.Self:
r"""
Create a new `AsyncOperator` for `s3` service.
@@ -2299,6 +2304,9 @@ class AsyncOperator:
session_token (aka, security token) of this backend.
This token will expire after sometime, it's
recommended to set session_token by hand.
+ skip_signature : builtins.bool, optional
+ Skip signature will skip loading credentials and
+ signing requests.
Returns
-------
@@ -3289,6 +3297,7 @@ class Operator:
endpoint: builtins.str = ...,
root: builtins.str = ...,
sas_token: builtins.str = ...,
+ skip_signature: builtins.bool = ...,
) -> typing.Self:
r"""
Create a new `Operator` for `azblob` service.
@@ -3321,6 +3330,9 @@ class Operator:
All operations will happen under this root.
sas_token : builtins.str, optional
The sas token of Azblob service backend.
+ skip_signature : builtins.bool, optional
+ Skip signature will skip loading credentials and
+ signing requests.
Returns
-------
@@ -4730,6 +4742,7 @@ class Operator:
server_side_encryption_customer_key: builtins.str = ...,
server_side_encryption_customer_key_md5: builtins.str = ...,
session_token: builtins.str = ...,
+ skip_signature: builtins.bool = ...,
) -> typing.Self:
r"""
Create a new `Operator` for `s3` service.
@@ -4903,6 +4916,9 @@ class Operator:
session_token (aka, security token) of this backend.
This token will expire after sometime, it's
recommended to set session_token by hand.
+ skip_signature : builtins.bool, optional
+ Skip signature will skip loading credentials and
+ signing requests.
Returns
-------
diff --git a/bindings/python/src/services.rs b/bindings/python/src/services.rs
index c29b2e1d4..b62cebdd9 100644
--- a/bindings/python/src/services.rs
+++ b/bindings/python/src/services.rs
@@ -2065,6 +2065,7 @@ submit! {
server_side_encryption_customer_key: builtins.str = ...,
server_side_encryption_customer_key_md5: builtins.str = ...,
session_token: builtins.str = ...,
+ skip_signature: builtins.bool = ...,
) -> typing.Self:
r"""
Create a new `Operator` for `s3` service.
@@ -2237,6 +2238,9 @@ submit! {
session_token (aka, security token) of this backend.
This token will expire after sometime, it's
recommended to set session_token by hand.
+ skip_signature : builtins.bool, optional
+ Skip signature will skip loading credentials and
+ signing requests.
Returns
-------
Operator
@@ -4751,6 +4755,7 @@ submit! {
server_side_encryption_customer_key: builtins.str = ...,
server_side_encryption_customer_key_md5: builtins.str = ...,
session_token: builtins.str = ...,
+ skip_signature: builtins.bool = ...,
) -> typing.Self:
r"""
Create a new `AsyncOperator` for `s3` service.
@@ -4923,6 +4928,9 @@ submit! {
session_token (aka, security token) of this backend.
This token will expire after sometime, it's
recommended to set session_token by hand.
+ skip_signature : builtins.bool, optional
+ Skip signature will skip loading credentials and
+ signing requests.
Returns
-------
AsyncOperator
diff --git a/core/services/s3/src/backend.rs b/core/services/s3/src/backend.rs
index c99581d5c..3ba8008a0 100644
--- a/core/services/s3/src/backend.rs
+++ b/core/services/s3/src/backend.rs
@@ -431,11 +431,20 @@ impl S3Builder {
self
}
+ /// Skip signature will skip loading credentials and signing requests.
+ pub fn skip_signature(mut self) -> Self {
+ self.config.skip_signature = true;
+ self
+ }
+
/// Allow anonymous will allow opendal to send request without signing
/// when credential is not loaded.
- pub fn allow_anonymous(mut self) -> Self {
- self.config.allow_anonymous = true;
- self
+ #[deprecated(
+ since = "0.57.0",
+ note = "Please use `skip_signature` instead of `allow_anonymous`"
+ )]
+ pub fn allow_anonymous(self) -> Self {
+ self.skip_signature()
}
/// Enable virtual host style so that opendal will send API requests
@@ -718,6 +727,11 @@ impl Builder for S3Builder {
credential_providers,
} = self;
+ #[allow(deprecated)]
+ if config.allow_anonymous {
+ config.skip_signature = true;
+ }
+
let root = normalize_root(&config.root.clone().unwrap_or_default());
debug!("backend use root {}", &root);
@@ -1000,7 +1014,7 @@ impl Builder for S3Builder {
server_side_encryption_customer_key,
server_side_encryption_customer_key_md5,
default_storage_class,
- allow_anonymous: config.allow_anonymous,
+ skip_signature: config.skip_signature,
disable_list_objects_v2: config.disable_list_objects_v2,
enable_request_payer: config.enable_request_payer,
signer,
@@ -1276,7 +1290,7 @@ mod tests {
let backend = S3Builder::default()
.bucket("test")
.region("us-east-1")
- .allow_anonymous()
+ .skip_signature()
.disable_config_load()
.disable_ec2_metadata()
.build()
diff --git a/core/services/s3/src/config.rs b/core/services/s3/src/config.rs
index d47233e1e..1b6e33ff3 100644
--- a/core/services/s3/src/config.rs
+++ b/core/services/s3/src/config.rs
@@ -124,8 +124,14 @@ pub struct S3Config {
/// This option is used to disable the default behavior of opendal
/// to load credential from ec2 metadata, a.k.a., IMDSv2
pub disable_ec2_metadata: bool,
+ /// Skip signature will skip loading credentials and signing requests.
+ pub skip_signature: bool,
/// Allow anonymous will allow opendal to send request without signing
/// when credential is not loaded.
+ #[deprecated(
+ since = "0.57.0",
+ note = "Please use `skip_signature` instead of `allow_anonymous`"
+ )]
pub allow_anonymous: bool,
/// server_side_encryption for this backend.
///
diff --git a/core/services/s3/src/core.rs b/core/services/s3/src/core.rs
index 846e6c9bf..600fb41e8 100644
--- a/core/services/s3/src/core.rs
+++ b/core/services/s3/src/core.rs
@@ -98,7 +98,7 @@ pub struct S3Core {
pub server_side_encryption_customer_key: Option<HeaderValue>,
pub server_side_encryption_customer_key_md5: Option<HeaderValue>,
pub default_storage_class: Option<HeaderValue>,
- pub allow_anonymous: bool,
+ pub skip_signature: bool,
pub disable_list_objects_v2: bool,
pub enable_request_payer: bool,
pub default_acl: Option<String>,
@@ -129,8 +129,7 @@ impl Debug for S3Core {
impl S3Core {
pub async fn sign_query<T>(&self, req: Request<T>, duration: Duration) -> Result<Request<T>> {
- // Skip signing for anonymous access
- if self.allow_anonymous {
+ if self.skip_signature {
return Ok(req);
}
@@ -154,8 +153,7 @@ impl S3Core {
}
pub async fn send(&self, req: Request<Buffer>) -> Result<Response<Buffer>> {
- // Skip signing for anonymous access
- if self.allow_anonymous {
+ if self.skip_signature {
return self.info.http_client().send(req).await;
}
@@ -181,8 +179,7 @@ impl S3Core {
}
pub async fn fetch(&self, req: Request<Buffer>) -> Result<Response<HttpBody>> {
- // Skip signing for anonymous access
- if self.allow_anonymous {
+ if self.skip_signature {
return self.info.http_client().fetch(req).await;
}
diff --git a/integrations/object_store/src/amazon_s3.rs b/integrations/object_store/src/amazon_s3.rs
index 9eb7a2058..5ae849bb5 100644
--- a/integrations/object_store/src/amazon_s3.rs
+++ b/integrations/object_store/src/amazon_s3.rs
@@ -66,7 +66,7 @@ impl OpendalStore {
source: Box::new(err),
})?;
if r {
- s3 = s3.allow_anonymous();
+ s3 = s3.skip_signature();
}
}