kanidm: an unset authsession_expiry means sessions never expire, not one day #308
Etiketter
Inga etiketter
area/backups
area/ci
area/control-panel
area/identity
area/infra
area/observability
area/payments
area/security
area/storage
area/web
blocked
needs-info
needs-triage
ready-for-implementation
type
bug
type
chore
type
docs
type
epic
type
feature
type
task
wontfix
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Inget förfallodatum satt.
Beroenden
Inga beroenden satta
Referens
bitborg/bitborg-infra#308
Läser in…
Hänvisa till i nytt ärende
Ingen beskrivning angiven.
Ta bort grenen "%!s()"
Borttagning av en gren är permanent. Även om den borttagna grenen kan fortsätta existera en kort tid innan den faktiskt tas bort, kan det INTE ångras i de flesta fall. Vill du fortsätta?
Found while declaring the account policy for #275, which deliberately recorded this as a recommendation
rather than applying it — changing session lifetime is its own reviewed change.
The finding
authsession_expiryis not set onidm_all_persons. The natural reading is that it therefore fallsback to a sensible default of one day. It does not.
Two constants exist in Kanidm 1.10.4,
server/lib/src/constants/mod.rs:174-176, and their own commentssay what they are:
The
DEFAULT_constant appears only in the server's own tests, not on the resolution path — so an unsetpolicy resolves to the maximum, i.e.
u32::MAXseconds. Authentication sessions on productiontherefore effectively never expire.
A second trap in the same area:
reset-auth-expiryis an HTTPDELETE(
libs/client/src/group.rs:40-46). It purges the attribute rather than restoring a default, so"resetting" it is what produces the never-expires state, not what fixes it.
Why it matters
Principle 4 is least privilege and being careful with users' data. A session that never expires means a
stolen or abandoned session cookie stays valid indefinitely — on a shared machine, a lost laptop, or
after an employment change. This is the single identity-posture knob most likely to be assumed rather
than checked, precisely because "unset" reads as "default".
It is also invisible: nothing in this repository diffs when an upstream default changes, which is the
general gap #275 set out to close.
Recommendation
and update
declared: 86400forauthsession_expiryinkanidm_account_policy(
roles/kanidm/defaults/main.yml) in the same change, or the next apply fails the newaccount-policy gate. That failure would be the gate working correctly.
Reversible, and existing sessions keep the expiry they were granted, so nobody is signed out by the
change itself.
Pick the value deliberately rather than adopting 86400 because it appears above — that number is
Kanidm's own test-only default, not a considered choice for this service.
privilege_expiryis worthdeciding in the same pass.
Verify before acting
The live value was not read: the cached
idm_adminCLI session had expired and there is noread-only route to it. Confirm with
kanidm group get idm_all_personsbefore changing anything — ifauthsession_expiryturns out to be set after all, the premise above is wrong and only thedocumentation needs correcting.