From eb70ad032a36afa8ba0a4a68bc838373c15c717e Mon Sep 17 00:00:00 2001 From: Jim Kalafut Date: Thu, 28 Jun 2018 09:42:04 -0700 Subject: [PATCH] Fix interface conversion panic during database creds revoke (#4850) --- builtin/logical/database/backend_test.go | 2 +- builtin/logical/database/secret_creds.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/builtin/logical/database/backend_test.go b/builtin/logical/database/backend_test.go index 39c5a49a3..753933418 100644 --- a/builtin/logical/database/backend_test.go +++ b/builtin/logical/database/backend_test.go @@ -603,7 +603,7 @@ func TestBackend_basic(t *testing.T) { "username": credsResp.Data["username"], "role": "plugin-role-test", "db_name": "plugin-test", - "revocation_statements": []string(nil), + "revocation_statements": []interface{}(nil), }, }, }) diff --git a/builtin/logical/database/secret_creds.go b/builtin/logical/database/secret_creds.go index b1e3ddd87..f4e41d8b0 100644 --- a/builtin/logical/database/secret_creds.go +++ b/builtin/logical/database/secret_creds.go @@ -111,7 +111,9 @@ func (b *databaseBackend) secretCredsRevoke() framework.OperationFunc { if statementsRaw, ok := req.Secret.InternalData["revocation_statements"]; !ok { return nil, fmt.Errorf("error during revoke: could not find role with name %q or embedded revocation statement data", req.Secret.InternalData["role"]) } else { - statements.Revocation = statementsRaw.([]string) + for _, v := range statementsRaw.([]interface{}) { + statements.Revocation = append(statements.Revocation, v.(string)) + } } }