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

Calculate namespace prefix before tainting route entries #21470

Merged
merged 6 commits into from Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -879,6 +879,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", "path", entry.Path, "namespace_path", entry.Namespace().Path)
VioletHynes marked this conversation as resolved.
Show resolved Hide resolved
c.router.Taint(ctx, path)
}

Expand Down
6 changes: 5 additions & 1 deletion vault/mount.go
Expand Up @@ -1593,7 +1593,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", "path", entry.Path, "namespace_path", entry.Namespace().Path)
VioletHynes marked this conversation as resolved.
Show resolved Hide resolved
c.router.Taint(ctx, path)
}

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