Skip to content

Commit

Permalink
VAULT-25883: Fix namespace errors with path filters on sys/internal/u…
Browse files Browse the repository at this point in the history
…i/mounts (#27939)

* include namespace in prefix fopr sys/internal/ui/mounts

* changelog
  • Loading branch information
miagilepner authored Aug 2, 2024
1 parent 01709e9 commit 2d1c3db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changelog/27939.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
core (enterprise): Fix 500 errors that occurred querying `sys/internal/ui/mounts` for a mount prefixed by a namespace path when path filters are configured.
```
8 changes: 8 additions & 0 deletions vault/logical_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -5075,6 +5075,14 @@ func (b *SystemBackend) pathInternalUIMountRead(ctx context.Context, req *logica
routerPrefix = credentialRoutePrefix
}

// the mount's namespace is (at least partially) in the request path and not
// in the request's context, so we need to add the namespace from the
// request path to the router prefix
if me.NamespaceID != ns.ID {
namespaceRouterPrefix := strings.TrimPrefix(me.Namespace().Path, ns.Path)
routerPrefix = namespaceRouterPrefix + routerPrefix
}

filtered, err := b.Core.checkReplicatedFiltering(ctx, me, routerPrefix)
if err != nil {
return nil, err
Expand Down

0 comments on commit 2d1c3db

Please sign in to comment.