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 2025/08/12 01:50:56 UTC
(opendal) branch main updated: fix(services/azblob): Fix azblob base64 validation (#6500)
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 c60d705d9 fix(services/azblob): Fix azblob base64 validation (#6500)
c60d705d9 is described below
commit c60d705d9bb70201fcbf1cb064137fb7d860e124
Author: kenwoodjw <bl...@gmail.com>
AuthorDate: Tue Aug 12 09:50:50 2025 +0800
fix(services/azblob): Fix azblob base64 validation (#6500)
* fix azblob base64 validation
Signed-off-by: kenwoodjw <bl...@gmail.com>
* fix lint
Signed-off-by: kenwoodjw <bl...@gmail.com>
---------
Signed-off-by: kenwoodjw <bl...@gmail.com>
---
core/src/services/azblob/backend.rs | 10 ++++++++++
core/src/types/list.rs | 2 +-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/core/src/services/azblob/backend.rs b/core/src/services/azblob/backend.rs
index c00c93a47..9b117cb05 100644
--- a/core/src/services/azblob/backend.rs
+++ b/core/src/services/azblob/backend.rs
@@ -338,6 +338,16 @@ impl Builder for AzblobBuilder {
}
if let Some(v) = self.config.account_key.clone() {
+ // Validate that account_key can be decoded as base64
+ if let Err(e) = BASE64_STANDARD.decode(&v) {
+ return Err(Error::new(
+ ErrorKind::ConfigInvalid,
+ format!("invalid account_key: cannot decode as base64: {}", e),
+ )
+ .with_operation("Builder::build")
+ .with_context("service", Scheme::Azblob)
+ .with_context("key", "account_key"));
+ }
config_loader.account_key = Some(v);
}
diff --git a/core/src/types/list.rs b/core/src/types/list.rs
index d82bd3bd7..15765abd5 100644
--- a/core/src/types/list.rs
+++ b/core/src/types/list.rs
@@ -114,7 +114,7 @@ mod tests {
let builder = Azblob::default()
.container("container")
.account_name("account_name")
- .account_key("account_key")
+ .account_key("YWNjb3VudF9rZXk=") // Valid base64 encoding of "account_key"
.endpoint("https://account_name.blob.core.windows.net");
let operator = Operator::new(builder)?.finish();