Skip to content

Commit 70272ee

Browse files
Fix - list_buckets allowing unauthorized bucket access
Signed-off-by: Aayush Chouhan <achouhan@redhat.com>
1 parent 0d75c6a commit 70272ee

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/server/system_services/bucket_server.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,8 +1057,13 @@ async function list_buckets(req) {
10571057
let continuation_token = req.rpc_params?.continuation_token;
10581058
const max_buckets = req.rpc_params?.max_buckets;
10591059

1060-
const accessible_bucket_list = system_store.data.buckets.filter(
1061-
async bucket => await req.has_s3_bucket_permission(bucket, "s3:ListBucket", req) && !bucket.deleting
1060+
const accessible_bucket_list = [];
1061+
await Promise.all(
1062+
system_store.data.buckets.map(async bucket => {
1063+
if (bucket.deleting) return;
1064+
const has_permission = await req.has_s3_bucket_permission(bucket, "s3:ListBucket", req);
1065+
if (has_permission) accessible_bucket_list.push(bucket);
1066+
})
10621067
);
10631068

10641069
accessible_bucket_list.sort((a, b) => a.name.unwrap().localeCompare(b.name.unwrap()));

0 commit comments

Comments
 (0)