Skip to content

Commit

Permalink
change bucket policy validation order in bucketspace-fs
Browse files Browse the repository at this point in the history
Signed-off-by: nadav mizrahi <nadav.mizrahi16@gmail.com>
  • Loading branch information
nadavMiz committed Apr 3, 2024
1 parent 19526c8 commit 4b3f4b3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sdk/bucketspace_fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,12 +568,13 @@ class BucketSpaceFS extends BucketSpaceSimpleFS {
const bucket_config_path = this._get_bucket_config_path(name);
const { data } = await nb_native().fs.readFile(this.fs_context, bucket_config_path);
const bucket = JSON.parse(data.toString());
await bucket_policy_utils.validate_s3_policy(policy, bucket.name, async principal => this._get_account_by_name(principal));
bucket.s3_policy = policy;
const bucket_to_validate = _.omitBy(bucket, _.isUndefined);
dbg.log2("put_bucket_policy: bucket properties before validate_bucket_schema",
bucket_to_validate);
nsfs_schema_utils.validate_bucket_schema(bucket_to_validate);
await bucket_policy_utils.validate_s3_policy(bucket.s3_policy, bucket.name, async principal =>
this._get_account_by_name(principal));
const update_bucket = JSON.stringify(bucket);
await nb_native().fs.writeFile(
this.fs_context,
Expand Down

0 comments on commit 4b3f4b3

Please sign in to comment.