[#XX] object: Make patch not set key before target construction
Some checks failed
Tests and linters / Run gofumpt (pull_request) Successful in 1m34s
DCO action / DCO (pull_request) Failing after 1m47s
Vulncheck / Vulncheck (pull_request) Successful in 2m57s
Pre-commit hooks / Pre-commit (pull_request) Successful in 3m9s
Build / Build Components (pull_request) Successful in 3m24s
Tests and linters / Staticcheck (pull_request) Successful in 3m19s
Tests and linters / gopls check (pull_request) Successful in 3m40s
Tests and linters / Lint (pull_request) Successful in 4m14s
Tests and linters / Tests (pull_request) Successful in 5m19s
Tests and linters / Tests with -race (pull_request) Successful in 6m5s

* `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 9a9de42aaf

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)