Skip to content

Commit

Permalink
backport of commit c3741b0 (#21484)
Browse files Browse the repository at this point in the history
Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
  • Loading branch information
1 parent 8d13ab4 commit 2dc73dd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelog/24170.txt
@@ -0,0 +1,3 @@
```release-note:bug
core: Fixed an instance where incorrect route entries would get tainted. We now pre-calculate namespace specific paths to avoid this.
```
1 change: 1 addition & 0 deletions vault/auth.go
Expand Up @@ -876,6 +876,7 @@ func (c *Core) setupCredentials(ctx context.Context) error {
// Calculate any namespace prefixes here, because when Taint() is called, there won't be
// a namespace to pull from the context. This is similar to what we do above in c.router.Mount().
path = entry.Namespace().Path + path
c.logger.Debug("tainting a mount due to it being marked as tainted in mount table", "entry.path", entry.Path, "entry.namespace.path", entry.Namespace().Path, "full_path", path)
c.router.Taint(ctx, path)
}

Expand Down
6 changes: 5 additions & 1 deletion vault/mount.go
Expand Up @@ -1571,7 +1571,11 @@ func (c *Core) setupMounts(ctx context.Context) error {

// Ensure the path is tainted if set in the mount table
if entry.Tainted {
c.router.Taint(ctx, entry.Path)
// Calculate any namespace prefixes here, because when Taint() is called, there won't be
// a namespace to pull from the context. This is similar to what we do above in c.router.Mount().
path := entry.Namespace().Path + entry.Path
c.logger.Debug("tainting a mount due to it being marked as tainted in mount table", "entry.path", entry.Path, "entry.namespace.path", entry.Namespace().Path, "full_path", path)
c.router.Taint(ctx, path)
}

// Ensure the cache is populated, don't need the result
Expand Down

0 comments on commit 2dc73dd

Please sign in to comment.