[#1458] object: Make patch not set key before target construction
All checks were successful
DCO action / DCO (pull_request) Successful in 1m6s
Tests and linters / Run gofumpt (pull_request) Successful in 1m30s
Tests and linters / Staticcheck (pull_request) Successful in 3m0s
Tests and linters / Tests with -race (pull_request) Successful in 3m47s
Tests and linters / Lint (pull_request) Successful in 4m16s
Pre-commit hooks / Pre-commit (pull_request) Successful in 4m48s
Vulncheck / Vulncheck (pull_request) Successful in 4m41s
Tests and linters / gopls check (pull_request) Successful in 5m10s
Build / Build Components (pull_request) Successful in 5m20s
Tests and linters / Tests (pull_request) Successful in 7m48s

* `SignRequestPrivateKey` field should be initialized either within
  `newUntrustedTarget` or within `newTrustedTarget`. Otherwise, all
  requests are signed by local node key that makes impossible to perform
  patch on non-container node.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
Airat Arifullin 2024-10-29 17:16:21 +03:00
parent bc8d79ddf9
commit 8a6c341b4d

View file

@ -113,10 +113,9 @@ func (s *Streamer) init(ctx context.Context, req *objectV2.PatchRequest) error {
oV2.GetHeader().SetOwnerID(ownerID)
target, err := target.New(objectwriter.Params{
Config: s.Config,
Common: commonPrm,
Header: objectSDK.NewFromV2(oV2),
SignRequestPrivateKey: s.localNodeKey,
Config: s.Config,
Common: commonPrm,
Header: objectSDK.NewFromV2(oV2),
})
if err != nil {
return fmt.Errorf("target creation: %w", err)