aboutsummaryrefslogtreecommitdiff
path: root/src/api/s3/bucket.rs
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2022-12-12 14:55:12 +0000
committerAlex <alex@adnab.me>2022-12-12 14:55:12 +0000
commitf7c65e830e66c9887d989a8281d8fae7f76f9c8c (patch)
tree1ee78730b1f7cb9d9c3fc4e93edfb7292e6a92f6 /src/api/s3/bucket.rs
parent980572a8872c56ea9572ff03579ebb9a65013775 (diff)
parent0e61e3b6fbe00e518225d851b04b47f6f1ba07a6 (diff)
downloadgarage-f7c65e830e66c9887d989a8281d8fae7f76f9c8c.tar.gz
garage-f7c65e830e66c9887d989a8281d8fae7f76f9c8c.zip
Merge pull request 'Properly enforce allow_create_bucket' (#447) from fix-allow-create-bucket into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/447
Diffstat (limited to 'src/api/s3/bucket.rs')
-rw-r--r--src/api/s3/bucket.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/api/s3/bucket.rs b/src/api/s3/bucket.rs
index 3ac6a6ec..8471385f 100644
--- a/src/api/s3/bucket.rs
+++ b/src/api/s3/bucket.rs
@@ -161,6 +161,15 @@ pub async fn handle_create_bucket(
return Err(CommonError::BucketAlreadyExists.into());
}
} else {
+ // Check user is allowed to create bucket
+ if !key_params.allow_create_bucket.get() {
+ return Err(CommonError::Forbidden(format!(
+ "Access key {} is not allowed to create buckets",
+ api_key.key_id
+ ))
+ .into());
+ }
+
// Create the bucket!
if !is_valid_bucket_name(&bucket_name) {
return Err(Error::bad_request(format!(