Reject requests read and write requests to cubbyhole with an empty path (#8971)
* Reject requests read and write requests to cubbyhole with an empty path
This commit is contained in:
parent
16cc804086
commit
c3b6db2f26
|
@ -111,6 +111,10 @@ func (b *CubbyholeBackend) handleRead(ctx context.Context, req *logical.Request,
|
|||
|
||||
path := data.Get("path").(string)
|
||||
|
||||
if path == "" {
|
||||
return nil, fmt.Errorf("missing path")
|
||||
}
|
||||
|
||||
// Read the path
|
||||
out, err := req.Storage.Get(ctx, req.ClientToken+"/"+path)
|
||||
if err != nil {
|
||||
|
@ -147,6 +151,10 @@ func (b *CubbyholeBackend) handleWrite(ctx context.Context, req *logical.Request
|
|||
|
||||
path := data.Get("path").(string)
|
||||
|
||||
if path == "" {
|
||||
return nil, fmt.Errorf("missing path")
|
||||
}
|
||||
|
||||
// JSON encode the data
|
||||
buf, err := json.Marshal(req.Data)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue