From c695f93852d670afe65aed60b6c3185f480f6789 Mon Sep 17 00:00:00 2001 From: Calvin Leung Huang Date: Thu, 14 Mar 2019 11:43:44 -0700 Subject: [PATCH] sys: do not show filtered mounts on internal/ui/mounts (#6412) --- vault/logical_system.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/vault/logical_system.go b/vault/logical_system.go index 21baf7423bf1..f7eebc568d8b 100644 --- a/vault/logical_system.go +++ b/vault/logical_system.go @@ -2899,6 +2899,14 @@ func (b *SystemBackend) pathInternalUIMountsRead(ctx context.Context, req *logic b.Core.mountsLock.RLock() for _, entry := range b.Core.mounts.Entries { + filtered, err := b.Core.checkReplicatedFiltering(ctx, entry, "") + if err != nil { + return nil, err + } + if filtered { + continue + } + if ns.ID == entry.NamespaceID && hasAccess(ctx, entry) { if isAuthed { // If this is an authed request return all the mount info @@ -2916,6 +2924,14 @@ func (b *SystemBackend) pathInternalUIMountsRead(ctx context.Context, req *logic b.Core.authLock.RLock() for _, entry := range b.Core.auth.Entries { + filtered, err := b.Core.checkReplicatedFiltering(ctx, entry, credentialRoutePrefix) + if err != nil { + return nil, err + } + if filtered { + continue + } + if ns.ID == entry.NamespaceID && hasAccess(ctx, entry) { if isAuthed { // If this is an authed request return all the mount info @@ -2955,6 +2971,14 @@ func (b *SystemBackend) pathInternalUIMountRead(ctx context.Context, req *logica return errResp, logical.ErrPermissionDenied } + filtered, err := b.Core.checkReplicatedFiltering(ctx, me, "") + if err != nil { + return nil, err + } + if filtered { + return errResp, logical.ErrPermissionDenied + } + resp := &logical.Response{ Data: mountInfo(me), }