From 3e78a1de5745bfe70bfe6813ada9fefb6d0856bd Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Wed, 18 Sep 2024 12:13:15 +0300 Subject: [PATCH] [#1383] object: Add restrictions for `Patch` method * `Patch` can't be applied for non-regular type object (tombstones, locks etc.) * Complex object parts can't be patched. So, if an object has EC/Split header, it won't be patched. Signed-off-by: Airat Arifullin --- pkg/services/object/patch/streamer.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/services/object/patch/streamer.go b/pkg/services/object/patch/streamer.go index 85c28cda0..c3f686d72 100644 --- a/pkg/services/object/patch/streamer.go +++ b/pkg/services/object/patch/streamer.go @@ -63,6 +63,14 @@ func (s *Streamer) init(ctx context.Context, req *objectV2.PatchRequest) error { return err } + if hdrWithSig.GetHeader().GetObjectType() != objectV2.TypeRegular { + return errors.New("non-regular object can't be patched") + } + + if hdrWithSig.GetHeader().GetEC() != nil || hdrWithSig.GetHeader().GetSplit() != nil { + return errors.New("complex object parts can't be patched") + } + commonPrm, err := util.CommonPrmFromV2(req) if err != nil { return err