From a28088443398ee3727e439896ba0f6554e0afc7c Mon Sep 17 00:00:00 2001 From: Nicolas Corrarello Date: Wed, 29 Nov 2017 10:36:34 +0000 Subject: [PATCH] Validating that Address and Token are provided in path_config_access.go --- builtin/logical/nomad/path_config_access.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/builtin/logical/nomad/path_config_access.go b/builtin/logical/nomad/path_config_access.go index 1b827dae6568..f45826c965cb 100644 --- a/builtin/logical/nomad/path_config_access.go +++ b/builtin/logical/nomad/path_config_access.go @@ -66,9 +66,17 @@ func (b *backend) pathConfigAccessRead( func (b *backend) pathConfigAccessWrite( req *logical.Request, data *framework.FieldData) (*logical.Response, error) { + address := data.Get("address").(string) + if address == "" { + return logical.ErrorResponse("missing nomad server address"), nil + } + token := data.Get("token").(string) + if token == "" { + return logical.ErrorResponse("missing nomad management token"), nil + } entry, err := logical.StorageEntryJSON("config/access", accessConfig{ - Address: data.Get("address").(string), - Token: data.Get("token").(string), + Address: address, + Token: token, }) if err != nil { return nil, err