forked from TrueCloudLab/frostfs-api-go
[#199] sdk/client: Verify eACL table signature in GetEACL method
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
3097059f85
commit
7611c218e3
1 changed files with 13 additions and 2 deletions
|
@ -350,9 +350,20 @@ func (c Client) getEACLV2(ctx context.Context, id *container.ID, opts ...CallOpt
|
||||||
return nil, errors.New("response body is nil")
|
return nil, errors.New("response body is nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
result := eacl.NewTableFromV2(body.GetEACL())
|
if err := signature.VerifyDataWithSource(
|
||||||
|
v2signature.StableMarshalerWrapper{
|
||||||
|
SM: body.GetEACL(),
|
||||||
|
},
|
||||||
|
func() (key, sig []byte) {
|
||||||
|
s := body.GetSignature()
|
||||||
|
|
||||||
// todo: check signature
|
return s.GetKey(), s.GetSign()
|
||||||
|
},
|
||||||
|
); err != nil {
|
||||||
|
return nil, errors.Wrap(err, "incorrect signature")
|
||||||
|
}
|
||||||
|
|
||||||
|
result := eacl.NewTableFromV2(body.GetEACL())
|
||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue