fix: resolve Issue #1465 - IAM credential change crash (#1535)

Co-authored-by: heihutu <30542132+heihutu@users.noreply.github.com>
Co-authored-by: houseme <housemecn@gmail.com>
Co-authored-by: loverustfs <hello@rustfs.com>
This commit is contained in:
yxrxy
2026-01-23 15:11:01 +08:00
committed by GitHub
parent e5284a85ed
commit 65de487eba
+8 -2
View File
@@ -130,8 +130,14 @@ impl ObjectStore {
}
fn decrypt_data(data: &[u8]) -> Result<Vec<u8>> {
let de = rustfs_crypto::decrypt_data(get_global_action_cred().unwrap_or_default().secret_key.as_bytes(), data)?;
Ok(de)
let cred = get_global_action_cred().unwrap_or_default();
match rustfs_crypto::decrypt_data(cred.secret_key.as_bytes(), data) {
Ok(decrypted) => Ok(decrypted),
Err(_) => {
warn!("Failed to decrypt IAM config data, treating as unencrypted");
Ok(data.to_vec())
}
}
}
fn encrypt_data(data: &[u8]) -> Result<Vec<u8>> {