[#357] Add check of request and resource tags #357

Merged
alexvanin merged 1 commit from mbiryukova/frostfs-s3-gw:feature/tags_to_policy_check into master 2024-04-17 07:07:00 +00:00
Member

Signed-off-by: Marina Biryukova m.biryukova@yadro.com

Signed-off-by: Marina Biryukova <m.biryukova@yadro.com>
mbiryukova self-assigned this 2024-04-10 07:47:42 +00:00
mbiryukova force-pushed feature/tags_to_policy_check from 84e123a0fb to 1c84cf5ae2 2024-04-10 07:48:14 +00:00 Compare
mbiryukova changed title from [#xxx] Add check of request and resource tags to [#357] Add check of request and resource tags 2024-04-10 07:48:41 +00:00
mbiryukova requested review from storage-services-committers 2024-04-10 08:01:19 +00:00
mbiryukova requested review from storage-services-developers 2024-04-10 08:01:19 +00:00
mbiryukova force-pushed feature/tags_to_policy_check from 1c84cf5ae2 to 0fe50f000d 2024-04-10 08:31:41 +00:00 Compare
mbiryukova force-pushed feature/tags_to_policy_check from 0fe50f000d to 780c329cab 2024-04-10 09:27:35 +00:00 Compare
mbiryukova force-pushed feature/tags_to_policy_check from 780c329cab to 0c47fd4228 2024-04-10 13:25:28 +00:00 Compare
dkirillov reviewed 2024-04-11 06:57:14 +00:00
dkirillov left a comment
Member

Looks good

Looks good
@ -30,0 +40,4 @@
CompleteMultipartUploadOperation,
UploadPartOperation,
UploadPartCopyOperation,
ListPartsOperation,
Member

Can aws restrict uploadPart/listingParts by resource attribute (that was added during create multipart upload)?

Can aws restrict uploadPart/listingParts by resource attribute (that was added during create multipart upload)?
Author
Member

It seems not

It seems not
dkirillov marked this conversation as resolved
@ -39,0 +59,4 @@
}
type ResourceTagging interface {
GetBucketInfo(ctx context.Context, name string) (*data.BucketInfo, error)
Member

This duplicates PolicyConfig.BucketResolver.

This duplicates `PolicyConfig.BucketResolver`.
dkirillov marked this conversation as resolved
@ -54,6 +84,7 @@ func PolicyCheck(cfg PolicyConfig) Func {
ctx := r.Context()
if err := policyCheck(r, cfg); err != nil {
reqLogOrDefault(ctx, cfg.Log).Error(logs.PolicyValidationFailed, zap.Error(err))
err = frostfsErrors.UnwrapErr(err)
Member

Why do we need this?

Why do we need this?
Author
Member

Without this we will return InternalError if requesting tags of non-existent bucket or object, instead of NoSuchBucket or NoSuchKey

Without this we will return `InternalError` if requesting tags of non-existent bucket or object, instead of `NoSuchBucket` or `NoSuchKey`
Member

Can we add test for such case then? For now If I remove this line tests still pass

Can we add test for such case then? For now If I remove this line tests still pass
dkirillov marked this conversation as resolved
@ -68,3 +99,3 @@
func policyCheck(r *http.Request, cfg PolicyConfig) error {
reqType, bktName, objName := getBucketObject(r, cfg.Domains)
req, err := getPolicyRequest(r, cfg.FrostfsID, reqType, bktName, objName, cfg.Log)
req, err := getPolicyRequest(r, cfg.FrostfsID, cfg.Decoder, cfg.Tagging, reqType, bktName, objName, cfg.Log)
Member

It seems we can pass whole cfg param

It seems we can pass whole `cfg` param
dkirillov marked this conversation as resolved
mbiryukova force-pushed feature/tags_to_policy_check from 0c47fd4228 to 3b76446d72 2024-04-11 11:06:29 +00:00 Compare
dkirillov approved these changes 2024-04-12 06:29:34 +00:00
ironbee approved these changes 2024-04-16 14:07:16 +00:00
alexvanin approved these changes 2024-04-17 07:06:53 +00:00
alexvanin merged commit 3ff027587c into master 2024-04-17 07:07:00 +00:00
alexvanin deleted branch feature/tags_to_policy_check 2024-04-17 07:07:01 +00:00
alexvanin added this to the v0.30.0 milestone 2024-05-27 11:14:12 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-s3-gw#357
No description provided.