fix(iam): report duplicate access keys clearly (#5066)

* fix(iam): report duplicate access keys clearly

* fix(iam): narrow duplicate access key handling
This commit is contained in:
GatewayJ
2026-07-21 16:14:06 +08:00
committed by GitHub
parent 7f569b67cb
commit 17f0bd2637
6 changed files with 134 additions and 15 deletions
+2 -2
View File
@@ -787,7 +787,7 @@ where
if let Some(x) = users.get(&cred.access_key)
&& x.credentials.is_service_account()
{
return Err(Error::IAMActionNotAllowed);
return Err(Error::AccessKeyAlreadyExists);
}
drop(cache);
drop(users);
@@ -1336,7 +1336,7 @@ where
if let Some(x) = users.get(access_key) {
warn!(error = ?x, "IAM user already exists");
if x.credentials.is_temp() {
return Err(Error::IAMActionNotAllowed);
return Err(Error::AccessKeyAlreadyExists);
}
}
drop(cache);