[#1613] morph: Add tracing for morph queries to neo-go
Some checks failed
DCO action / DCO (pull_request) Successful in 59s
Vulncheck / Vulncheck (pull_request) Successful in 1m4s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m55s
Build / Build Components (pull_request) Successful in 2m4s
Tests and linters / Staticcheck (pull_request) Successful in 2m38s
Tests and linters / Lint (pull_request) Successful in 3m16s
Tests and linters / Run gofumpt (pull_request) Successful in 3m54s
Tests and linters / Tests (pull_request) Successful in 4m12s
Tests and linters / gopls check (pull_request) Successful in 4m31s
Tests and linters / Tests with -race (pull_request) Successful in 4m38s
OCI image / Build container images (push) Failing after 18s
Vulncheck / Vulncheck (push) Successful in 1m2s
Pre-commit hooks / Pre-commit (push) Successful in 1m39s
Build / Build Components (push) Successful in 1m45s
Tests and linters / Staticcheck (push) Successful in 2m18s
Tests and linters / Run gofumpt (push) Successful in 2m46s
Tests and linters / Lint (push) Successful in 3m5s
Tests and linters / Tests with -race (push) Successful in 3m23s
Tests and linters / Tests (push) Successful in 3m52s
Tests and linters / gopls check (push) Successful in 4m18s
Some checks failed
DCO action / DCO (pull_request) Successful in 59s
Vulncheck / Vulncheck (pull_request) Successful in 1m4s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m55s
Build / Build Components (pull_request) Successful in 2m4s
Tests and linters / Staticcheck (pull_request) Successful in 2m38s
Tests and linters / Lint (pull_request) Successful in 3m16s
Tests and linters / Run gofumpt (pull_request) Successful in 3m54s
Tests and linters / Tests (pull_request) Successful in 4m12s
Tests and linters / gopls check (pull_request) Successful in 4m31s
Tests and linters / Tests with -race (pull_request) Successful in 4m38s
OCI image / Build container images (push) Failing after 18s
Vulncheck / Vulncheck (push) Successful in 1m2s
Pre-commit hooks / Pre-commit (push) Successful in 1m39s
Build / Build Components (push) Successful in 1m45s
Tests and linters / Staticcheck (push) Successful in 2m18s
Tests and linters / Run gofumpt (push) Successful in 2m46s
Tests and linters / Lint (push) Successful in 3m5s
Tests and linters / Tests with -race (push) Successful in 3m23s
Tests and linters / Tests (push) Successful in 3m52s
Tests and linters / gopls check (push) Successful in 4m18s
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
parent
4de5fca547
commit
9b113c3156
120 changed files with 623 additions and 562 deletions
|
@ -78,12 +78,12 @@ var _ Server = (*Service)(nil)
|
|||
|
||||
// validateContainerTargetRequest validates request for the container target.
|
||||
// It checks if request actor is the owner of the container, otherwise it denies the request.
|
||||
func (s *Service) validateContainerTargetRequest(cid string, pubKey *keys.PublicKey) error {
|
||||
func (s *Service) validateContainerTargetRequest(ctx context.Context, cid string, pubKey *keys.PublicKey) error {
|
||||
var cidSDK cidSDK.ID
|
||||
if err := cidSDK.DecodeString(cid); err != nil {
|
||||
return fmt.Errorf("invalid CID format: %w", err)
|
||||
}
|
||||
isOwner, err := s.isActorContainerOwner(cidSDK, pubKey)
|
||||
isOwner, err := s.isActorContainerOwner(ctx, cidSDK, pubKey)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to check owner: %w", err)
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ func (s *Service) AddChain(ctx context.Context, req *apemanagerV2.AddChainReques
|
|||
switch targetType := req.GetBody().GetTarget().GetTargetType(); targetType {
|
||||
case apeV2.TargetTypeContainer:
|
||||
reqCID := req.GetBody().GetTarget().GetName()
|
||||
if err = s.validateContainerTargetRequest(reqCID, pub); err != nil {
|
||||
if err = s.validateContainerTargetRequest(ctx, reqCID, pub); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
target = policy_engine.ContainerTarget(reqCID)
|
||||
|
@ -153,7 +153,7 @@ func (s *Service) RemoveChain(ctx context.Context, req *apemanagerV2.RemoveChain
|
|||
switch targetType := req.GetBody().GetTarget().GetTargetType(); targetType {
|
||||
case apeV2.TargetTypeContainer:
|
||||
reqCID := req.GetBody().GetTarget().GetName()
|
||||
if err = s.validateContainerTargetRequest(reqCID, pub); err != nil {
|
||||
if err = s.validateContainerTargetRequest(ctx, reqCID, pub); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
target = policy_engine.ContainerTarget(reqCID)
|
||||
|
@ -177,7 +177,7 @@ func (s *Service) RemoveChain(ctx context.Context, req *apemanagerV2.RemoveChain
|
|||
return resp, nil
|
||||
}
|
||||
|
||||
func (s *Service) ListChains(_ context.Context, req *apemanagerV2.ListChainsRequest) (*apemanagerV2.ListChainsResponse, error) {
|
||||
func (s *Service) ListChains(ctx context.Context, req *apemanagerV2.ListChainsRequest) (*apemanagerV2.ListChainsResponse, error) {
|
||||
pub, err := getSignaturePublicKey(req.GetVerificationHeader())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -188,7 +188,7 @@ func (s *Service) ListChains(_ context.Context, req *apemanagerV2.ListChainsRequ
|
|||
switch targetType := req.GetBody().GetTarget().GetTargetType(); targetType {
|
||||
case apeV2.TargetTypeContainer:
|
||||
reqCID := req.GetBody().GetTarget().GetName()
|
||||
if err = s.validateContainerTargetRequest(reqCID, pub); err != nil {
|
||||
if err = s.validateContainerTargetRequest(ctx, reqCID, pub); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
target = policy_engine.ContainerTarget(reqCID)
|
||||
|
@ -237,13 +237,13 @@ func getSignaturePublicKey(vh *session.RequestVerificationHeader) (*keys.PublicK
|
|||
return key, nil
|
||||
}
|
||||
|
||||
func (s *Service) isActorContainerOwner(cid cidSDK.ID, pk *keys.PublicKey) (bool, error) {
|
||||
func (s *Service) isActorContainerOwner(ctx context.Context, cid cidSDK.ID, pk *keys.PublicKey) (bool, error) {
|
||||
var actor user.ID
|
||||
user.IDFromKey(&actor, (ecdsa.PublicKey)(*pk))
|
||||
actorOwnerID := new(refs.OwnerID)
|
||||
actor.WriteToV2(actorOwnerID)
|
||||
|
||||
cnr, err := s.cnrSrc.Get(cid)
|
||||
cnr, err := s.cnrSrc.Get(ctx, cid)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("get container error: %w", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue