Skip to content

Commit 321de03

Browse files
authored
Merge pull request #9328 from shirady/iam-block-access-key-api-on-accounts
IAM | Block Accounts From Performing IAM API on Themselves
2 parents 7362470 + 68aed49 commit 321de03

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/util/account_util.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,10 @@ function validate_and_return_requested_account(params, action, requesting_accoun
701701
// When accesskeyt API called without specific username, action on the same requesting account.
702702
// So in that case requesting account and requested account is same.
703703
requested_account = requesting_account;
704+
// we do not allow for AWS account root user to perform IAM action on itself
705+
if (requesting_account.owner === undefined) {
706+
throw new RpcError('NOT_AUTHORIZED', 'You do not have permission to perform this action.');
707+
}
704708
} else {
705709
_check_if_requesting_account_is_root_account(action, requesting_account, { username: params.username });
706710
const account_email = get_account_name_from_username(params.username, requesting_account._id.toString());

0 commit comments

Comments
 (0)