Skip to content

Commit

Permalink
sys: use full mount path for checkAccess on internal/ui/mounts/:path (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
calvn authored May 8, 2020
1 parent 94dfb5d commit fd58ee5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions vault/logical_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@ import (
"sync"
"time"

multierror "github.com/hashicorp/go-multierror"
"github.com/hashicorp/vault/physical/raft"

"github.com/hashicorp/errwrap"
log "github.com/hashicorp/go-hclog"
memdb "github.com/hashicorp/go-memdb"
multierror "github.com/hashicorp/go-multierror"
uuid "github.com/hashicorp/go-uuid"
"github.com/hashicorp/vault/helper/hostutil"
"github.com/hashicorp/vault/helper/identity"
"github.com/hashicorp/vault/helper/metricsutil"
"github.com/hashicorp/vault/helper/namespace"
"github.com/hashicorp/vault/physical/raft"
"github.com/hashicorp/vault/sdk/framework"
"github.com/hashicorp/vault/sdk/helper/consts"
"github.com/hashicorp/vault/sdk/helper/jsonutil"
Expand Down Expand Up @@ -3037,13 +3036,15 @@ func (b *SystemBackend) pathInternalUIMountRead(ctx context.Context, req *logica
if filtered {
return errResp, logical.ErrPermissionDenied
}

resp := &logical.Response{
Data: mountInfo(me),
}
resp.Data["path"] = me.Path

fullMountPath := ns.Path + me.Path
if ns.ID != me.Namespace().ID {
resp.Data["path"] = me.Namespace().Path + me.Path
fullMountPath = ns.Path + me.Namespace().Path + me.Path
}

// Load the ACL policies so we can walk the prefix for this mount
Expand All @@ -3060,7 +3061,7 @@ func (b *SystemBackend) pathInternalUIMountRead(ctx context.Context, req *logica
return nil, logical.ErrPermissionDenied
}

if !hasMountAccess(ctx, acl, ns.Path+me.Path) {
if !hasMountAccess(ctx, acl, fullMountPath) {
return errResp, logical.ErrPermissionDenied
}

Expand Down

0 comments on commit fd58ee5

Please sign in to comment.