metainfo: add project info rpc for getting a project salt using an api key (#2311)

The API exposed in #2302 needs to be able to get a project-level salt (https://github.com/storj/storj/pull/2302/files#diff-72b734f4a2e408a544fef071d2565fc8R200), see https://github.com/storj/storj/blob/master/docs/design/password-key-derivation.md also

I realized this morning that if we need it later this week, we need to get it into today's release.

Please describe the tests: tests will come as part of #2302

Please describe the performance impact: none
This commit is contained in:
JT Olio 2019-06-24 11:15:45 -06:00 committed by GitHub
parent fd6a4d96f2
commit e17908a266
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 224 additions and 67 deletions

View File

@ -33,16 +33,19 @@ var (
type ActionType int
const (
_ ActionType = iota // ActionType zero value
// not using iota because these values are persisted in macaroons
_ ActionType = 0
// ActionRead specifies a read operation
ActionRead
ActionRead ActionType = 1
// ActionWrite specifies a read operation
ActionWrite
ActionWrite ActionType = 2
// ActionList specifies a read operation
ActionList
ActionList ActionType = 3
// ActionDelete specifies a read operation
ActionDelete
ActionDelete ActionType = 4
// ActionProjectInfo requests project-level information
ActionProjectInfo ActionType = 5
)
// Action specifies the specific operation being performed that the Macaroon will validate
@ -165,6 +168,8 @@ func (c *Caveat) Allows(action Action) bool {
if c.DisallowDeletes {
return false
}
case ActionProjectInfo:
// allow
default:
return false
}

View File

@ -841,6 +841,74 @@ func (m *SetAttributionResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_SetAttributionResponse proto.InternalMessageInfo
type ProjectInfoRequest struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ProjectInfoRequest) Reset() { *m = ProjectInfoRequest{} }
func (m *ProjectInfoRequest) String() string { return proto.CompactTextString(m) }
func (*ProjectInfoRequest) ProtoMessage() {}
func (*ProjectInfoRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_631e2f30a93cd64e, []int{15}
}
func (m *ProjectInfoRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ProjectInfoRequest.Unmarshal(m, b)
}
func (m *ProjectInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ProjectInfoRequest.Marshal(b, m, deterministic)
}
func (m *ProjectInfoRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ProjectInfoRequest.Merge(m, src)
}
func (m *ProjectInfoRequest) XXX_Size() int {
return xxx_messageInfo_ProjectInfoRequest.Size(m)
}
func (m *ProjectInfoRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ProjectInfoRequest.DiscardUnknown(m)
}
var xxx_messageInfo_ProjectInfoRequest proto.InternalMessageInfo
type ProjectInfoResponse struct {
ProjectSalt []byte `protobuf:"bytes,1,opt,name=project_salt,json=projectSalt,proto3" json:"project_salt,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ProjectInfoResponse) Reset() { *m = ProjectInfoResponse{} }
func (m *ProjectInfoResponse) String() string { return proto.CompactTextString(m) }
func (*ProjectInfoResponse) ProtoMessage() {}
func (*ProjectInfoResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_631e2f30a93cd64e, []int{16}
}
func (m *ProjectInfoResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ProjectInfoResponse.Unmarshal(m, b)
}
func (m *ProjectInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ProjectInfoResponse.Marshal(b, m, deterministic)
}
func (m *ProjectInfoResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ProjectInfoResponse.Merge(m, src)
}
func (m *ProjectInfoResponse) XXX_Size() int {
return xxx_messageInfo_ProjectInfoResponse.Size(m)
}
func (m *ProjectInfoResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ProjectInfoResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ProjectInfoResponse proto.InternalMessageInfo
func (m *ProjectInfoResponse) GetProjectSalt() []byte {
if m != nil {
return m.ProjectSalt
}
return nil
}
func init() {
proto.RegisterType((*AddressedOrderLimit)(nil), "metainfo.AddressedOrderLimit")
proto.RegisterType((*SegmentWriteRequest)(nil), "metainfo.SegmentWriteRequest")
@ -858,70 +926,75 @@ func init() {
proto.RegisterType((*ListSegmentsResponse_Item)(nil), "metainfo.ListSegmentsResponse.Item")
proto.RegisterType((*SetAttributionRequest)(nil), "metainfo.SetAttributionRequest")
proto.RegisterType((*SetAttributionResponse)(nil), "metainfo.SetAttributionResponse")
proto.RegisterType((*ProjectInfoRequest)(nil), "metainfo.ProjectInfoRequest")
proto.RegisterType((*ProjectInfoResponse)(nil), "metainfo.ProjectInfoResponse")
}
func init() { proto.RegisterFile("metainfo.proto", fileDescriptor_631e2f30a93cd64e) }
var fileDescriptor_631e2f30a93cd64e = []byte{
// 922 bytes of a gzipped FileDescriptorProto
// 967 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xdd, 0x6e, 0x1b, 0x45,
0x14, 0x66, 0xfd, 0x13, 0xc7, 0xc7, 0x4e, 0x0c, 0x93, 0x90, 0xae, 0xb6, 0x0d, 0x36, 0xcb, 0x4d,
0x90, 0x90, 0x2b, 0xa5, 0x57, 0x50, 0x6e, 0xf2, 0x53, 0x44, 0x50, 0x1b, 0xa2, 0x0d, 0xa2, 0x52,
0x85, 0x58, 0x8d, 0xbd, 0xc7, 0xee, 0x08, 0xef, 0xce, 0x32, 0x33, 0x86, 0xb4, 0xf7, 0x3c, 0x40,
0x2f, 0x78, 0x25, 0xd4, 0x0b, 0x1e, 0x00, 0x71, 0xd1, 0x67, 0x41, 0xf3, 0xb3, 0xf6, 0x3a, 0xb6,
0x09, 0x48, 0xbe, 0xdb, 0x73, 0xe6, 0x9b, 0xf3, 0xf3, 0x7d, 0x67, 0x8e, 0x0d, 0xbb, 0x29, 0x2a,
0xca, 0xb2, 0x11, 0xef, 0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, 0xbd, 0x95, 0xf8, 0x02, 0x2a, 0xde, 0xd1,
0x86, 0x5b, 0x9b, 0xeb, 0x7b, 0x68, 0xe6, 0xaa, 0x9a, 0xf7, 0xd7, 0x5d, 0x79, 0x71, 0x43, 0xd8,
0xbd, 0xfb, 0xff, 0x11, 0xb1, 0x98, 0xda, 0x68, 0xc3, 0xe6, 0xa9, 0x97, 0x94, 0x69, 0xcd, 0xd4,
0x37, 0xb4, 0xe5, 0x29, 0x34, 0x8a, 0x3f, 0x83, 0x22, 0x2d, 0x6b, 0x84, 0xa2, 0x48, 0xcb, 0xda,
0x1f, 0xdb, 0x00, 0x0e, 0x96, 0xb7, 0x8b, 0x2c, 0x75, 0xb0, 0x66, 0xa1, 0xbd, 0xee, 0xe6, 0x80,
0x05, 0x33, 0x85, 0x15, 0x2c, 0x32, 0xb3, 0xba, 0xaf, 0x45, 0x66, 0xd6, 0xec, 0xed, 0xd9, 0xce,
0xf3, 0x52, 0x3a, 0x1c, 0xee, 0xea, 0xff, 0x49, 0x0f, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x14,
0x86, 0xb1, 0x2d, 0x1e, 0x0b, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -943,6 +1016,7 @@ type MetainfoClient interface {
DeleteSegment(ctx context.Context, in *SegmentDeleteRequest, opts ...grpc.CallOption) (*SegmentDeleteResponse, error)
ListSegments(ctx context.Context, in *ListSegmentsRequest, opts ...grpc.CallOption) (*ListSegmentsResponse, error)
SetAttribution(ctx context.Context, in *SetAttributionRequest, opts ...grpc.CallOption) (*SetAttributionResponse, error)
ProjectInfo(ctx context.Context, in *ProjectInfoRequest, opts ...grpc.CallOption) (*ProjectInfoResponse, error)
}
type metainfoClient struct {
@ -1016,6 +1090,15 @@ func (c *metainfoClient) SetAttribution(ctx context.Context, in *SetAttributionR
return out, nil
}
func (c *metainfoClient) ProjectInfo(ctx context.Context, in *ProjectInfoRequest, opts ...grpc.CallOption) (*ProjectInfoResponse, error) {
out := new(ProjectInfoResponse)
err := c.cc.Invoke(ctx, "/metainfo.Metainfo/ProjectInfo", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MetainfoServer is the server API for Metainfo service.
type MetainfoServer interface {
CreateSegment(context.Context, *SegmentWriteRequest) (*SegmentWriteResponse, error)
@ -1025,6 +1108,7 @@ type MetainfoServer interface {
DeleteSegment(context.Context, *SegmentDeleteRequest) (*SegmentDeleteResponse, error)
ListSegments(context.Context, *ListSegmentsRequest) (*ListSegmentsResponse, error)
SetAttribution(context.Context, *SetAttributionRequest) (*SetAttributionResponse, error)
ProjectInfo(context.Context, *ProjectInfoRequest) (*ProjectInfoResponse, error)
}
func RegisterMetainfoServer(s *grpc.Server, srv MetainfoServer) {
@ -1157,6 +1241,24 @@ func _Metainfo_SetAttribution_Handler(srv interface{}, ctx context.Context, dec
return interceptor(ctx, in, info, handler)
}
func _Metainfo_ProjectInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ProjectInfoRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MetainfoServer).ProjectInfo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/metainfo.Metainfo/ProjectInfo",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MetainfoServer).ProjectInfo(ctx, req.(*ProjectInfoRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Metainfo_serviceDesc = grpc.ServiceDesc{
ServiceName: "metainfo.Metainfo",
HandlerType: (*MetainfoServer)(nil),
@ -1189,6 +1291,10 @@ var _Metainfo_serviceDesc = grpc.ServiceDesc{
MethodName: "SetAttribution",
Handler: _Metainfo_SetAttribution_Handler,
},
{
MethodName: "ProjectInfo",
Handler: _Metainfo_ProjectInfo_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "metainfo.proto",

View File

@ -21,6 +21,7 @@ service Metainfo {
rpc DeleteSegment(SegmentDeleteRequest) returns (SegmentDeleteResponse);
rpc ListSegments(ListSegmentsRequest) returns (ListSegmentsResponse);
rpc SetAttribution(SetAttributionRequest) returns (SetAttributionResponse);
rpc ProjectInfo(ProjectInfoRequest) returns (ProjectInfoResponse);
}
message AddressedOrderLimit {
@ -55,7 +56,7 @@ message SegmentCommitResponse {
}
message SegmentDownloadRequest {
bytes bucket = 1;
bytes bucket = 1;
bytes path = 2;
int64 segment = 3;
}
@ -66,7 +67,7 @@ message SegmentDownloadResponse {
}
message SegmentInfoRequest {
bytes bucket = 1;
bytes bucket = 1;
bytes path = 2;
int64 segment = 3;
}
@ -101,7 +102,7 @@ message ListSegmentsResponse {
pointerdb.Pointer pointer = 2;
bool is_prefix = 3;
}
repeated Item items = 1;
bool more = 2;
}
@ -112,4 +113,11 @@ message SetAttributionRequest{
}
message SetAttributionResponse {
}
}
message ProjectInfoRequest {
}
message ProjectInfoResponse {
bytes project_salt = 1;
}

View File

@ -1789,6 +1789,19 @@
},
{
"name": "SetAttributionResponse"
},
{
"name": "ProjectInfoRequest"
},
{
"name": "ProjectInfoResponse",
"fields": [
{
"id": 1,
"name": "project_salt",
"type": "bytes"
}
]
}
],
"services": [
@ -1829,6 +1842,11 @@
"name": "SetAttribution",
"in_type": "SetAttributionRequest",
"out_type": "SetAttributionResponse"
},
{
"name": "ProjectInfo",
"in_type": "ProjectInfoRequest",
"out_type": "ProjectInfoResponse"
}
]
}

View File

@ -5,6 +5,7 @@ package metainfo
import (
"context"
"crypto/sha256"
"errors"
"strconv"
"time"
@ -579,3 +580,22 @@ func bytesToUUID(data []byte) (uuid.UUID, error) {
return id, nil
}
// ProjectInfo returns allowed ProjectInfo for the provided API key
func (endpoint *Endpoint) ProjectInfo(ctx context.Context, req *pb.ProjectInfoRequest) (_ *pb.ProjectInfoResponse, err error) {
defer mon.Task()(&ctx)(&err)
keyInfo, err := endpoint.validateAuth(ctx, macaroon.Action{
Op: macaroon.ActionProjectInfo,
Time: time.Now(),
})
if err != nil {
return nil, status.Errorf(codes.Unauthenticated, err.Error())
}
salt := sha256.Sum256(keyInfo.ProjectID[:])
return &pb.ProjectInfoResponse{
ProjectSalt: salt[:],
}, nil
}