Skip to content

Commit

Permalink
Fix interface conversion panic during database creds revoke (#4850)
Browse files Browse the repository at this point in the history
  • Loading branch information
kalafut authored and briankassouf committed Jun 28, 2018
1 parent 7bf1047 commit 3a8b404
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion builtin/logical/database/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
},
})
Expand Down
4 changes: 3 additions & 1 deletion builtin/logical/database/secret_creds.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
}

Expand Down

0 comments on commit 3a8b404

Please sign in to comment.