Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport 1.4.2: sys: use full mount path for checkAccess on internal/ui/mounts/:path … #8964

Merged
merged 1 commit into from
May 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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