ui/mounts: Add a better error message when permission is denied (#4624)
* ui/mounts: Add a better error message when permission is denied * Update logical_system.go
This commit is contained in:
parent
7749f3cb3f
commit
210df327d1
|
@ -3598,11 +3598,13 @@ func (b *SystemBackend) pathInternalUIMountRead(ctx context.Context, req *logica
|
|||
}
|
||||
path = sanitizeMountPath(path)
|
||||
|
||||
errResp := logical.ErrorResponse(fmt.Sprintf("Preflight capability check returned 403, please ensure client's policies grant access to path \"%s\"", path))
|
||||
|
||||
me := b.Core.router.MatchingMountEntry(path)
|
||||
if me == nil {
|
||||
// Return a permission denied error here so this path cannot be used to
|
||||
// brute force a list of mounts.
|
||||
return nil, logical.ErrPermissionDenied
|
||||
return errResp, logical.ErrPermissionDenied
|
||||
}
|
||||
|
||||
resp := &logical.Response{
|
||||
|
@ -3616,11 +3618,11 @@ func (b *SystemBackend) pathInternalUIMountRead(ctx context.Context, req *logica
|
|||
return nil, err
|
||||
}
|
||||
if entity != nil && entity.Disabled {
|
||||
return nil, logical.ErrPermissionDenied
|
||||
return errResp, logical.ErrPermissionDenied
|
||||
}
|
||||
|
||||
if !hasMountAccess(acl, me.Path) {
|
||||
return nil, logical.ErrPermissionDenied
|
||||
return errResp, logical.ErrPermissionDenied
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
|
|
Loading…
Reference in New Issue