From 6f42135ec0f4f3cd7c07aa472f33fedec80fe666 Mon Sep 17 00:00:00 2001 From: Sammy Kerata Oina <44265300+SammyOina@users.noreply.github.com> Date: Tue, 6 Feb 2024 19:55:42 +0300 Subject: [PATCH] NOISSUE - Fetch attestation report (#66) * Improve attestation and update deps Enhanced the attestation process to require additional report data and a variable privacy level, catering to varying security requirements. The `Run` method's context parameter was removed to simplify invocation following API alignment. Dependencies got updated, notably adding `github.com/google/go-sev-guest` for attestation, and some were indirectly bumped. These updates ensure the agent service leverages the latest available features and improvements for security and stability. Signed-off-by: SammyOina * Extend AttestationRequest with data fields Enhanced the AttestationRequest message structure by introducing 'report_data' and 'vpml' fields to encapsulate additional attestation context. Adjusted service and middleware layers to incorporate these new parameters, enabling richer attestation workflows. The GRPC endpoint, logging, and metrics layers have been updated to handle the additional data, catering to more secure and nuanced attestation use cases. Refactors Attestation command in CLI to accept report data argument and include an optional 'vpml' flag for specifying virtual machine privilege level. This change empowers users to request attestation with specific context directly from the CLI. Signed-off-by: SammyOina * Refactor attestation to remove vpml dependency Removed the `vpml` field from the AttestationRequest protobuf, and all associated handling code, streamlining the attestation process. Code adjustments were made in gRPC client, server, and service layers to ensure proper request construction and validation that focuses only on report data. This change simplifies the attestation API and its usage, reducing error risk and improving maintainability. It reflects a decision to decouple the protocol from specific vendor measurement levels, potentially due to a shift towards a more generalized attestation procedure. Signed-off-by: SammyOina * Enhance CLI usability and streamline SDK attestation - Added a usage example to the CLI attestation command for better user guidance. - Simplified the SDK attestation function by removing an unused parameter and directly populating the request structure with report data to align function parameters with actual usage requirements. Signed-off-by: SammyOina --------- Signed-off-by: SammyOina --- agent/agent.pb.go | 53 +++++++++++++++++++++++--------------- agent/agent.proto | 4 ++- agent/api/grpc/client.go | 9 ++++--- agent/api/grpc/endpoint.go | 2 +- agent/api/grpc/requests.go | 6 +++-- agent/api/grpc/server.go | 4 +-- agent/api/logging.go | 8 +++--- agent/api/metrics.go | 8 +++--- agent/service.go | 26 +++++++++++-------- cli/attestation.go | 8 +++--- cmd/agent/main.go | 2 +- go.mod | 8 ++++++ go.sum | 18 +++++++++++++ pkg/sdk/agent.go | 8 +++--- 14 files changed, 108 insertions(+), 56 deletions(-) diff --git a/agent/agent.pb.go b/agent/agent.pb.go index 7721c72f..fa02355b 100644 --- a/agent/agent.pb.go +++ b/agent/agent.pb.go @@ -341,6 +341,8 @@ type AttestationRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + ReportData []byte `protobuf:"bytes,1,opt,name=report_data,json=reportData,proto3" json:"report_data,omitempty"` } func (x *AttestationRequest) Reset() { @@ -375,6 +377,13 @@ func (*AttestationRequest) Descriptor() ([]byte, []int) { return file_agent_agent_proto_rawDescGZIP(), []int{6} } +func (x *AttestationRequest) GetReportData() []byte { + if x != nil { + return x.ReportData + } + return nil +} + type AttestationResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -448,28 +457,30 @@ var file_agent_agent_proto_rawDesc = []byte{ 0x73, 0x75, 0x6d, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x22, 0x24, 0x0a, 0x0e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x22, 0x14, 0x0a, 0x12, 0x41, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x22, 0x35, 0x0a, 0x12, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x22, 0x29, 0x0a, 0x13, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x32, 0xf5, 0x01, 0x0a, - 0x0c, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x31, 0x0a, - 0x04, 0x41, 0x6c, 0x67, 0x6f, 0x12, 0x12, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x41, 0x6c, - 0x67, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x61, 0x67, 0x65, 0x6e, - 0x74, 0x2e, 0x41, 0x6c, 0x67, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x12, 0x31, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, - 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x61, - 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x14, 0x2e, - 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x0b, - 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x2e, 0x61, 0x67, - 0x65, 0x6e, 0x74, 0x2e, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x41, - 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x44, 0x61, + 0x74, 0x61, 0x22, 0x29, 0x0a, 0x13, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x69, 0x6c, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x32, 0xf5, 0x01, + 0x0a, 0x0c, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x31, + 0x0a, 0x04, 0x41, 0x6c, 0x67, 0x6f, 0x12, 0x12, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x41, + 0x6c, 0x67, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x61, 0x67, 0x65, + 0x6e, 0x74, 0x2e, 0x41, 0x6c, 0x67, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x31, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, 0x2e, 0x61, 0x67, 0x65, 0x6e, + 0x74, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, + 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x14, + 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, + 0x0b, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x2e, 0x61, + 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, + 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/agent/agent.proto b/agent/agent.proto index a37fb438..b276bf76 100644 --- a/agent/agent.proto +++ b/agent/agent.proto @@ -36,6 +36,8 @@ message ResultRequest { message ResultResponse { bytes file = 1; } -message AttestationRequest { } +message AttestationRequest { + bytes report_data = 1; +} message AttestationResponse { bytes file = 1; } diff --git a/agent/api/grpc/client.go b/agent/api/grpc/client.go index 042ca190..eae7891a 100644 --- a/agent/api/grpc/client.go +++ b/agent/api/grpc/client.go @@ -147,8 +147,11 @@ func decodeResultResponse(_ context.Context, grpcResponse interface{}) (interfac // encodeAttestationRequest is a transport/grpc.EncodeRequestFunc that // converts a user-domain attestationReq to a gRPC request. func encodeAttestationRequest(_ context.Context, request interface{}) (interface{}, error) { - // No request parameters needed for retrieving computation result file. - return &agent.AttestationRequest{}, nil + req, ok := request.(*attestationReq) + if !ok { + return nil, fmt.Errorf("invalid request type: %T", request) + } + return &agent.AttestationRequest{ReportData: req.ReportData}, nil } // decodeAttestationResponse is a transport/grpc.DecodeResponseFunc that @@ -211,7 +214,7 @@ func (c grpcClient) Attestation(ctx context.Context, request *agent.AttestationR ctx, cancel := context.WithTimeout(ctx, c.timeout) defer cancel() - res, err := c.attestation(ctx, &attestationReq{}) + res, err := c.attestation(ctx, &attestationReq{ReportData: request.ReportData}) if err != nil { return nil, err } diff --git a/agent/api/grpc/endpoint.go b/agent/api/grpc/endpoint.go index 18847798..adbabc18 100644 --- a/agent/api/grpc/endpoint.go +++ b/agent/api/grpc/endpoint.go @@ -70,7 +70,7 @@ func attestationEndpoint(svc agent.Service) endpoint.Endpoint { if err := req.validate(); err != nil { return attestationRes{}, err } - file, err := svc.Attestation(ctx) + file, err := svc.Attestation(ctx, req.ReportData) if err != nil { return attestationRes{}, err } diff --git a/agent/api/grpc/requests.go b/agent/api/grpc/requests.go index ef40624d..8287f757 100644 --- a/agent/api/grpc/requests.go +++ b/agent/api/grpc/requests.go @@ -54,10 +54,12 @@ func (req resultReq) validate() error { } type attestationReq struct { - // No request parameters needed for retrieving attestation output + ReportData []byte } func (req attestationReq) validate() error { - // No request parameters to validate, so no validation logic needed + if req.ReportData == nil { + return errors.New("malformed entity") + } return nil } diff --git a/agent/api/grpc/server.go b/agent/api/grpc/server.go index 373273bc..a720d8a4 100644 --- a/agent/api/grpc/server.go +++ b/agent/api/grpc/server.go @@ -90,8 +90,8 @@ func encodeResultResponse(_ context.Context, response interface{}) (interface{}, } func decodeAttestationRequest(_ context.Context, grpcReq interface{}) (interface{}, error) { - // No fields to extract from gRPC request, so returning an empty struct - return attestationReq{}, nil + req := grpcReq.(*agent.AttestationRequest) + return attestationReq{ReportData: req.ReportData}, nil } func encodeAttestationResponse(_ context.Context, response interface{}) (interface{}, error) { diff --git a/agent/api/logging.go b/agent/api/logging.go index 9ed78089..cfe1b374 100644 --- a/agent/api/logging.go +++ b/agent/api/logging.go @@ -27,7 +27,7 @@ func LoggingMiddleware(svc agent.Service, logger *slog.Logger) agent.Service { return &loggingMiddleware{logger, svc} } -func (lm *loggingMiddleware) Run(ctx context.Context, ac agent.Computation) (response string, err error) { +func (lm *loggingMiddleware) Run(ac agent.Computation) (response string, err error) { defer func(begin time.Time) { message := fmt.Sprintf("Method Run for computation %s took %s to complete", ac.ID, time.Since(begin)) if err != nil { @@ -37,7 +37,7 @@ func (lm *loggingMiddleware) Run(ctx context.Context, ac agent.Computation) (res lm.logger.Info(fmt.Sprintf("%s without errors.", message)) }(time.Now()) - return lm.svc.Run(ctx, ac) + return lm.svc.Run(ac) } func (lm *loggingMiddleware) Algo(ctx context.Context, algorithm agent.Algorithm) (response string, err error) { @@ -79,7 +79,7 @@ func (lm *loggingMiddleware) Result(ctx context.Context, consumer string) (respo return lm.svc.Result(ctx, consumer) } -func (lm *loggingMiddleware) Attestation(ctx context.Context) (response []byte, err error) { +func (lm *loggingMiddleware) Attestation(ctx context.Context, reportData []byte) (response []byte, err error) { defer func(begin time.Time) { message := fmt.Sprintf("Method Attestation took %s to complete", time.Since(begin)) if err != nil { @@ -89,5 +89,5 @@ func (lm *loggingMiddleware) Attestation(ctx context.Context) (response []byte, lm.logger.Info(fmt.Sprintf("%s without errors", message)) }(time.Now()) - return lm.svc.Attestation(ctx) + return lm.svc.Attestation(ctx, reportData) } diff --git a/agent/api/metrics.go b/agent/api/metrics.go index 4b025091..fc4febc4 100644 --- a/agent/api/metrics.go +++ b/agent/api/metrics.go @@ -32,13 +32,13 @@ func MetricsMiddleware(svc agent.Service, counter metrics.Counter, latency metri } } -func (ms *metricsMiddleware) Run(ctx context.Context, ac agent.Computation) (string, error) { +func (ms *metricsMiddleware) Run(ac agent.Computation) (string, error) { defer func(begin time.Time) { ms.counter.With("method", "run").Add(1) ms.latency.With("method", "run").Observe(time.Since(begin).Seconds()) }(time.Now()) - return ms.svc.Run(ctx, ac) + return ms.svc.Run(ac) } func (ms *metricsMiddleware) Algo(ctx context.Context, algorithm agent.Algorithm) (string, error) { @@ -68,11 +68,11 @@ func (ms *metricsMiddleware) Result(ctx context.Context, consumer string) ([]byt return ms.svc.Result(ctx, consumer) } -func (ms *metricsMiddleware) Attestation(ctx context.Context) ([]byte, error) { +func (ms *metricsMiddleware) Attestation(ctx context.Context, reportData []byte) ([]byte, error) { defer func(begin time.Time) { ms.counter.With("method", "attestation").Add(1) ms.latency.With("method", "attestation").Observe(time.Since(begin).Seconds()) }(time.Now()) - return ms.svc.Attestation(ctx) + return ms.svc.Attestation(ctx, reportData) } diff --git a/agent/service.go b/agent/service.go index ebff8644..50288187 100644 --- a/agent/service.go +++ b/agent/service.go @@ -6,6 +6,7 @@ package agent import ( "context" "crypto/sha256" + "crypto/sha512" "encoding/hex" "encoding/json" "errors" @@ -14,6 +15,7 @@ import ( "os/exec" "slices" + "github.com/google/go-sev-guest/client" "github.com/ultravioletrs/cocos/agent/events" "github.com/ultravioletrs/cocos/pkg/socket" ) @@ -46,11 +48,11 @@ var ( // Service specifies an API that must be fullfiled by the domain service // implementation, and all of its decorators (e.g. logging & metrics). type Service interface { - Run(ctx context.Context, c Computation) (string, error) + Run(c Computation) (string, error) Algo(ctx context.Context, algorithm Algorithm) (string, error) Data(ctx context.Context, dataset Dataset) (string, error) Result(ctx context.Context, consumer string) ([]byte, error) - Attestation(ctx context.Context) ([]byte, error) + Attestation(ctx context.Context, reportData []byte) ([]byte, error) } type agentService struct { @@ -58,7 +60,6 @@ type agentService struct { algorithms [][]byte datasets [][]byte result []byte - attestation []byte sm *StateMachine runError error eventSvc events.Service @@ -90,7 +91,7 @@ func New(ctx context.Context, logger *slog.Logger, eventSvc events.Service) Serv return svc } -func (as *agentService) Run(ctx context.Context, c Computation) (string, error) { +func (as *agentService) Run(c Computation) (string, error) { if as.sm.GetState() != receivingManifests { return "", errStateNotReady } @@ -195,14 +196,17 @@ func (as *agentService) Result(ctx context.Context, consumer string) ([]byte, er return as.result, as.runError } -func (as *agentService) Attestation(ctx context.Context) ([]byte, error) { - // Implement the logic for the Attestation method here - // Use the provided ctx parameter as needed - var attestation []byte +func (as *agentService) Attestation(ctx context.Context, reportData []byte) ([]byte, error) { + provider, err := client.GetQuoteProvider() + if err != nil { + return []byte{}, err + } + rawQuote, err := provider.GetRawQuote(sha512.Sum512(reportData)) + if err != nil { + return []byte{}, err + } - as.attestation = attestation - - return as.attestation, nil + return rawQuote, nil } func (as *agentService) runComputation() { diff --git a/cli/attestation.go b/cli/attestation.go index f7882e45..51329412 100644 --- a/cli/attestation.go +++ b/cli/attestation.go @@ -13,12 +13,14 @@ const attestationFilePath = "attestation.txt" func (cli *CLI) NewAttestationCmd() *cobra.Command { return &cobra.Command{ - Use: "attestation", - Short: "Retrieve attestation information", + Use: "attestation", + Short: "Retrieve attestation information", + Example: "attestation ", + Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { log.Println("Checking attestation") - result, err := cli.agentSDK.Attestation(cmd.Context()) + result, err := cli.agentSDK.Attestation(cmd.Context(), []byte(args[0])) if err != nil { log.Fatalf("Error retrieving attestation: %v", err) } diff --git a/cmd/agent/main.go b/cmd/agent/main.go index 21ae2194..c519a83d 100644 --- a/cmd/agent/main.go +++ b/cmd/agent/main.go @@ -66,7 +66,7 @@ func main() { defer eventSvc.Close() svc := newService(ctx, logger, eventSvc) - if _, err := svc.Run(ctx, cfg); err != nil { + if _, err := svc.Run(cfg); err != nil { if err := eventSvc.SendEvent("init", "failed", json.RawMessage{}); err != nil { logger.Warn(err.Error()) } diff --git a/go.mod b/go.mod index 6f591d61..a070948d 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,7 @@ require ( github.com/go-kit/kit v0.13.0 github.com/go-zoo/bone v1.3.0 github.com/gofrs/uuid v4.4.0+incompatible + github.com/google/go-sev-guest v0.10.1 github.com/mdlayher/vsock v1.2.1 github.com/prometheus/client_golang v1.18.0 github.com/spf13/cobra v1.8.0 @@ -36,15 +37,22 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect + github.com/google/go-configfs-tsm v0.2.2 // indirect + github.com/google/logger v1.1.1 // indirect + github.com/google/uuid v1.5.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/mdlayher/socket v0.4.1 // indirect + github.com/pborman/uuid v1.2.1 // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/crypto v0.18.0 // indirect golang.org/x/net v0.20.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/go.sum b/go.sum index 1904fc06..d80ffdb2 100644 --- a/go.sum +++ b/go.sum @@ -49,6 +49,15 @@ github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-configfs-tsm v0.2.2 h1:YnJ9rXIOj5BYD7/0DNnzs8AOp7UcvjfTvt215EWcs98= +github.com/google/go-configfs-tsm v0.2.2/go.mod h1:EL1GTDFMb5PZQWDviGfZV9n87WeGTR/JUg13RfwkgRo= +github.com/google/go-sev-guest v0.10.1 h1:kZIcGD513eqInbezqxchTtOLJlVXALyWlIXu5E0tNJE= +github.com/google/go-sev-guest v0.10.1/go.mod h1:/5hrgGWqG7+MPTXKhQz+v9ZE+Eh4MCBdItCNwgshlrk= +github.com/google/logger v1.1.1 h1:+6Z2geNxc9G+4D4oDO9njjjn2d0wN5d7uOo0vOIW1NQ= +github.com/google/logger v1.1.1/go.mod h1:BkeJZ+1FhQ+/d087r4dzojEg1u2ZX+ZqG1jTUrLM+zQ= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= +github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 h1:Wqo399gCIufwto+VfwCSvsnfGpF/w5E9CNxSwbpD6No= github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0/go.mod h1:qmOFXW2epJhM0qSnUUYpldc7gVz2KMQwJ/QYCDIa7XU= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= @@ -59,6 +68,10 @@ github.com/mdlayher/socket v0.4.1 h1:eM9y2/jlbs1M615oshPQOHZzj6R6wMT7bX5NPiQvn2U github.com/mdlayher/socket v0.4.1/go.mod h1:cAqeGjoufqdxWkD7DkpyS+wcefOtmu5OQ8KuoJGIReA= github.com/mdlayher/vsock v1.2.1 h1:pC1mTJTvjo1r9n9fbm7S1j04rCgCzhCOS5DY0zqHlnQ= github.com/mdlayher/vsock v1.2.1/go.mod h1:NRfCibel++DgeMD8z/hP+PPTjlNJsdPOmxcnENvE+SE= +github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw= +github.com/pborman/uuid v1.2.1/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -102,8 +115,12 @@ go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8 go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -118,6 +135,7 @@ golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/pkg/sdk/agent.go b/pkg/sdk/agent.go index c00f2452..5c36f821 100644 --- a/pkg/sdk/agent.go +++ b/pkg/sdk/agent.go @@ -23,7 +23,7 @@ func NewAgentSDK(log *slog.Logger, agentClient agent.AgentServiceClient) *agentS } } -func (sdk *agentSDK) Run(ctx context.Context, ac agent.Computation) (string, error) { +func (sdk *agentSDK) Run(ac agent.Computation) (string, error) { return "", nil } @@ -73,8 +73,10 @@ func (sdk *agentSDK) Result(ctx context.Context, consumer string) ([]byte, error return response.File, nil } -func (sdk *agentSDK) Attestation(ctx context.Context) ([]byte, error) { - request := &agent.AttestationRequest{} +func (sdk *agentSDK) Attestation(ctx context.Context, reportData []byte) ([]byte, error) { + request := &agent.AttestationRequest{ + ReportData: reportData, + } response, err := sdk.client.Attestation(ctx, request) if err != nil {