From c7d932c636a5d4d0cdff5de2fa1cdad4aaa2aa39 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Wed, 1 Dec 2021 18:43:40 +0000 Subject: [PATCH] further name validation --- function/handler/function.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/function/handler/function.go b/function/handler/function.go index 76519de..f32f166 100644 --- a/function/handler/function.go +++ b/function/handler/function.go @@ -218,6 +218,10 @@ func (e *Function) Deploy(ctx context.Context, req *function.DeployRequest, rsp func (e *Function) Call(ctx context.Context, req *function.CallRequest, rsp *function.CallResponse) error { log.Info("Received Function.Call request") + if len(req.Name) == 0 { + return errors.BadRequest("function.call", "Missing function name") + } + tenantId, ok := tenant.FromContext(ctx) if !ok { tenantId = "micro" @@ -263,6 +267,10 @@ func (e *Function) Call(ctx context.Context, req *function.CallRequest, rsp *fun func (e *Function) Delete(ctx context.Context, req *function.DeleteRequest, rsp *function.DeleteResponse) error { log.Info("Received Function.Delete request") + if len(req.Name) == 0 { + return errors.BadRequest("function.delete", "Missing function name") + } + tenantId, ok := tenant.FromContext(ctx) if !ok { tenantId = "micro" @@ -344,6 +352,10 @@ func (e *Function) List(ctx context.Context, req *function.ListRequest, rsp *fun } func (e *Function) Describe(ctx context.Context, req *function.DescribeRequest, rsp *function.DescribeResponse) error { + if len(req.Name) == 0 { + return errors.BadRequest("function.describe", "Missing function name") + } + tenantId, ok := tenant.FromContext(ctx) if !ok { tenantId = "micro"