use provided namespace for wrapping lookup cubbyhole request (#15583)
* use provided namespace for wrapping lookup cubbyhole request * add changelog entry
This commit is contained in:
parent
fddbd2fe66
commit
cdb73ab265
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
core (enterprise): Fix bug where wrapping token lookup does not work within namespaces.
|
||||
```
|
|
@ -3404,13 +3404,23 @@ func (b *SystemBackend) handleWrappingLookup(ctx context.Context, req *logical.R
|
|||
return nil, errors.New("token is not a valid unwrap token")
|
||||
}
|
||||
|
||||
lookupNS, err := NamespaceByID(ctx, te.NamespaceID, b.Core)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if lookupNS == nil {
|
||||
return nil, errors.New("token is not from a valid namespace")
|
||||
}
|
||||
|
||||
lookupCtx := namespace.ContextWithNamespace(ctx, lookupNS)
|
||||
|
||||
cubbyReq := &logical.Request{
|
||||
Operation: logical.ReadOperation,
|
||||
Path: "cubbyhole/wrapinfo",
|
||||
ClientToken: token,
|
||||
}
|
||||
cubbyReq.SetTokenEntry(te)
|
||||
cubbyResp, err := b.Core.router.Route(ctx, cubbyReq)
|
||||
cubbyResp, err := b.Core.router.Route(lookupCtx, cubbyReq)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error looking up wrapping information: %w", err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue