Skip to content

Commit bbb05dd

Browse files
committed
CR improve log printing in case there is no IAM policy
Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
1 parent 66f2a35 commit bbb05dd

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/endpoint/s3/s3_rest.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,10 +344,14 @@ async function authorize_request_iam_policy(req) {
344344

345345
const resource_arn = _get_arn_from_req_path(req) || '*'; // special case for list all buckets in an account
346346
const method = _get_method_from_req(req);
347+
const requesting_account = req.object_sdk.requesting_account;
347348
const iam_policies = account.iam_user_policies || [];
348-
if (iam_policies.length === 0 && req.object_sdk.nsfs_config_root) return; // We do not have IAM policies in NC yet
349+
if (iam_policies.length === 0) {
350+
if (req.object_sdk.nsfs_config_root) return; // We do not have IAM policies in NC yet
351+
dbg.log1('authorize_request_iam_policy: IAM user has no inline policies configured');
352+
_throw_iam_access_denied_error_for_s3_operation(requesting_account, method, resource_arn);
353+
}
349354

350-
const requesting_account = req.object_sdk.requesting_account;
351355
// parallel policy check
352356
const promises = [];
353357
for (const iam_policy of iam_policies) {
@@ -367,7 +371,7 @@ async function authorize_request_iam_policy(req) {
367371
}
368372
}
369373
if (has_allow_permission) return;
370-
dbg.log1('authorize_request_iam_policy: user have inline policies but none of them matched the method');
374+
dbg.log1('authorize_request_iam_policy: user has inline policies but none of them matched the method');
371375
_throw_iam_access_denied_error_for_s3_operation(requesting_account, method, resource_arn);
372376
}
373377

0 commit comments

Comments
 (0)