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

sys/internal/counters/activity APIs are inconsistent about rendering activity log info with invalid mount_accessor data #18814

Closed
maxb opened this issue Jan 24, 2023 · 0 comments · Fixed by #18916
Labels
core/api core/log devex Developer Experience

Comments

@maxb
Copy link
Contributor

maxb commented Jan 24, 2023

Activity log entries contain a mount_accessor field.

It can be missing, either because pre-1.10 Vault didn't write it at all, or because of bugs such as that mentioned in #18809. It could also be present but pointing at a deleted mount.

Some parts of the activity log code account for this:

vault/vault/activity_log.go

Lines 2341 to 2361 in 3ded138

for mountAccessor, mountData := range nsMap[nsID].Mounts {
var displayPath string
if mountAccessor == "" {
displayPath = "no mount accessor (pre-1.10 upgrade?)"
} else {
valResp := a.core.router.ValidateMountByAccessor(mountAccessor)
if valResp == nil {
displayPath = fmt.Sprintf("deleted mount; accessor %q", mountAccessor)
} else {
displayPath = valResp.MountPath
}
}
mountRecord = append(mountRecord, &activity.MountRecord{
MountPath: displayPath,
Counts: &activity.CountsRecord{
EntityClients: len(mountData.Counts.Entities),
NonEntityClients: int(mountData.Counts.Tokens) + len(mountData.Counts.NonEntities),
},
})
}

Other parts just throw data away if they don't successfully resolve a mount:

vault/vault/activity_log.go

Lines 2169 to 2173 in 3ded138

valResp := a.core.router.ValidateMountByAccessor(mountAccessor)
if valResp == nil {
// Only persist valid mounts
continue
}

Which is incredibly confusing for users, when different parts of the JSON returned by Vault tell different stories about actual activity!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core/api core/log devex Developer Experience
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants