Group cache (WIKI.auth.groups) silently stays empty when the initial reloadGroups() fails at boot — breaks OIDC mapGroups and silently strips users' group memberships
#8030
Unanswered
papso-kirby
asked this question in
Error / Bug Report
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
WIKI.auth.reloadGroups()is called fire-and-forget at startup, withoutawaitand without a.catch(), and the function itself has no error handling. If the very firstgroupsquery fails for any transient reason at boot (e.g. aKnex: Timeout acquiring a connection. The pool is probably fullduring the startup burst), the rejection is swallowed andthis.groupsis never populated. It then stays empty for the entire process lifetime.This is hard to notice because nothing is logged, and the wiki otherwise boots and runs normally.
Impact (severity: data loss)
With an OpenID Connect strategy that has
mapGroups: true, every login runs:When WIKI.auth.groups is empty, expectedGroups is always [], so:
So a transient DB hiccup at boot can progressively wipe out group assignments as users log in. In our case the SSO group assignments dropped from 18 → 16 before we noticed.
To Reproduce
memberships lose them.
Expected behavior
The group cache must be reliably populated at boot. A transient DB error during startup must not leave the cache permanently empty, and mapGroups must never remove memberships based on an empty/unloaded cache.
Root cause (code, v2.5.311 server/core/auth.js)
A single rejected query here = empty cache for the whole process. The only recovery is something that calls reloadGroups() again at runtime (e.g. saving any group in the admin UI), which masks the problem.
Environment
Suggested fix
Beta Was this translation helpful? Give feedback.
All reactions