VAULT-25883: Fix namespace errors with path filters on sys/internal/ui/mounts (#27939)

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

* changelog
This commit is contained in:
miagilepner 2024-08-02 10:28:34 +02:00 committed by GitHub
parent 01709e992a
commit 2d1c3db46b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

3
changelog/27939.txt Normal file
View File

@ -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.
```

View File

@ -5075,6 +5075,14 @@ func (b *SystemBackend) pathInternalUIMountRead(ctx context.Context, req *logica
routerPrefix = credentialRoutePrefix 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) filtered, err := b.Core.checkReplicatedFiltering(ctx, me, routerPrefix)
if err != nil { if err != nil {
return nil, err return nil, err