mongodb secret backend: Handle cases where stored username or db is not a string as expected when revoking credentials
This commit is contained in:
parent
75a5fbd8fe
commit
f8e6bcbb69
|
@ -51,6 +51,9 @@ func (b *backend) secretCredsRevoke(req *logical.Request, d *framework.FieldData
|
|||
return nil, fmt.Errorf("secret is missing username internal data")
|
||||
}
|
||||
username, ok := usernameRaw.(string)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("username internal data is not a string")
|
||||
}
|
||||
|
||||
// Get the db from the internal data
|
||||
dbRaw, ok := req.Secret.InternalData["db"]
|
||||
|
@ -58,6 +61,9 @@ func (b *backend) secretCredsRevoke(req *logical.Request, d *framework.FieldData
|
|||
return nil, fmt.Errorf("secret is missing db internal data")
|
||||
}
|
||||
db, ok := dbRaw.(string)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("db internal data is not a string")
|
||||
}
|
||||
|
||||
// Get our connection
|
||||
session, err := b.Session(req.Storage)
|
||||
|
|
Loading…
Reference in a new issue