Skip to content

Commit f0711be

Browse files
committed
**fix(auth): prevent access to removed credentials lingering in memory**
Add logic to avoid exposing credentials that have been removed from disk but still persist in memory. Ensure `runtimeOnly` checks and proper handling of disabled or removed authentication states.
1 parent 1d0f030 commit f0711be

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/api/handlers/management/auth_files.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,10 @@ func (h *Handler) buildAuthFileEntry(auth *coreauth.Auth) gin.H {
346346
entry["size"] = info.Size()
347347
entry["modtime"] = info.ModTime()
348348
} else if os.IsNotExist(err) {
349+
// Hide credentials removed from disk but still lingering in memory.
350+
if !runtimeOnly && (auth.Disabled || auth.Status == coreauth.StatusDisabled || strings.EqualFold(strings.TrimSpace(auth.StatusMessage), "removed via management api")) {
351+
return nil
352+
}
349353
entry["source"] = "memory"
350354
} else {
351355
log.WithError(err).Warnf("failed to stat auth file %s", path)

0 commit comments

Comments
 (0)