mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
Fix for Issue 11863 - Panic when creating/updating approle role with token_type (#11864)
* initializing resp variable with aa *logical.Response before using it to add warning for default-service or default-batch token type. Also adding guard around code that sets resp to a new logical.Response further on in the function. * adding changelog entry * renaming changelog file to match PR number
This commit is contained in:
@@ -887,9 +887,11 @@ func (b *backend) pathRoleCreateUpdate(ctx context.Context, req *logical.Request
|
||||
switch tokenTypeRaw.(string) {
|
||||
case "default-service":
|
||||
data.Raw["token_type"] = "service"
|
||||
resp = &logical.Response{}
|
||||
resp.AddWarning("default-service has no useful meaning; adjusting to service")
|
||||
case "default-batch":
|
||||
data.Raw["token_type"] = "batch"
|
||||
resp = &logical.Response{}
|
||||
resp.AddWarning("default-batch has no useful meaning; adjusting to batch")
|
||||
}
|
||||
}
|
||||
@@ -976,7 +978,9 @@ func (b *backend) pathRoleCreateUpdate(ctx context.Context, req *logical.Request
|
||||
}
|
||||
|
||||
if role.TokenMaxTTL > b.System().MaxLeaseTTL() {
|
||||
resp = &logical.Response{}
|
||||
if resp == nil {
|
||||
resp = &logical.Response{}
|
||||
}
|
||||
resp.AddWarning("token_max_ttl is greater than the backend mount's maximum TTL value; issued tokens' max TTL value will be truncated")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user