mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-27 15:37:02 +00:00
fix: is-admin api (For STS/temporary credentials, we need to check the… (#1101)
Co-authored-by: loverustfs <hello@rustfs.com>
This commit is contained in:
@@ -158,14 +158,15 @@ impl Operation for IsAdminHandler {
|
|||||||
return Err(s3_error!(InvalidRequest, "get cred failed"));
|
return Err(s3_error!(InvalidRequest, "get cred failed"));
|
||||||
};
|
};
|
||||||
|
|
||||||
let (_cred, _owner) =
|
let (cred, _owner) =
|
||||||
check_key_valid(get_session_token(&req.uri, &req.headers).unwrap_or_default(), &input_cred.access_key).await?;
|
check_key_valid(get_session_token(&req.uri, &req.headers).unwrap_or_default(), &input_cred.access_key).await?;
|
||||||
|
|
||||||
let access_key_to_check = input_cred.access_key.clone();
|
let access_key_to_check = input_cred.access_key.clone();
|
||||||
|
|
||||||
// Check if the user is admin by comparing with global credentials
|
// Check if the user is admin by comparing with global credentials
|
||||||
let is_admin = if let Some(sys_cred) = get_global_action_cred() {
|
let is_admin = if let Some(sys_cred) = get_global_action_cred() {
|
||||||
sys_cred.access_key == access_key_to_check
|
crate::auth::constant_time_eq(&access_key_to_check, &sys_cred.access_key)
|
||||||
|
|| crate::auth::constant_time_eq(&cred.parent_user, &sys_cred.access_key)
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user