Skip to content

Commit a6ae534

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 14eef70 commit a6ae534

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
@@ -343,10 +343,14 @@ async function authorize_request_iam_policy(req) {
343343

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

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

0 commit comments

Comments
 (0)