Live group resolution: membership changes should apply without re-login #96

Closed
opened 2026-08-03 20:34:24 +00:00 by Cordy · 1 comment
Owner

Follow-up to #94 (route A decided 2026-08-03: spaces broker to the IdP). Sequenced by Nikola: tackle after #95.

The v1 trade being fixed: OIDC group membership rides in the session (memory-only, 12h TTL), so when a space owner grants someone access, the new member only sees the space at their next login/session refresh — same lag for revocations, which is also a (bounded) security window: a removed member keeps access until their session ends.

Direction: resolve groups live instead of (or layered over) the session snapshot — e.g. the scope decorator consults a short-TTL per-user group cache populated via the Keycloak Admin API (the cairn-keycustody service account already reads users and groups for key custody), refreshing every 1–5 minutes or on 403-style misses. LDAP mode already resolves memberOf at bind time, so its staleness window is the Basic-auth fingerprint cache — review both paths together.

Design points to settle at implementation time: cache TTL vs. Admin API load; whether revocation should additionally invalidate live sessions; keeping the no-IdP fallback (local auth) unaffected.

Follow-up to #94 (route A decided 2026-08-03: spaces broker to the IdP). Sequenced by Nikola: **tackle after #95.** **The v1 trade being fixed:** OIDC group membership rides in the session (memory-only, 12h TTL), so when a space owner grants someone access, the new member only sees the space at their next login/session refresh — same lag for revocations, which is also a (bounded) security window: a removed member keeps access until their session ends. **Direction:** resolve groups live instead of (or layered over) the session snapshot — e.g. the scope decorator consults a short-TTL per-user group cache populated via the Keycloak Admin API (the `cairn-keycustody` service account already reads users and groups for key custody), refreshing every 1–5 minutes or on 403-style misses. LDAP mode already resolves `memberOf` at bind time, so its staleness window is the Basic-auth fingerprint cache — review both paths together. Design points to settle at implementation time: cache TTL vs. Admin API load; whether revocation should additionally invalidate live sessions; keeping the no-IdP fallback (local auth) unaffected.
Author
Owner

Shipped in v0.3.28 (PR #99), live on .249 — startup log confirms live group resolution enabled (#96).

auth.WithLiveGroups re-resolves User.Groups per request through the Keycloak Admin API (same cairn-keycustody client, 60s cache). Grants apply within a minute; revocations too — the removed-member window shrinks from session lifetime (12h) to cache TTL. Sits under the admin-flag evaluation, so adding/removing someone from cairn-admins also applies live. IdP outage → session snapshot stands, 30s negative cache. App-password requests covered; LDAP unchanged (resolves memberOf at bind; its staleness is the credential-cache window, documented).

Dogfood check: create a space, add a second user, and have them refresh (no re-logout) after ~1 minute — the space should appear. Remove them and their access should vanish within a minute too.

Shipped in **v0.3.28** (PR #99), live on .249 — startup log confirms `live group resolution enabled (#96)`. `auth.WithLiveGroups` re-resolves `User.Groups` per request through the Keycloak Admin API (same `cairn-keycustody` client, 60s cache). Grants apply within a minute; revocations too — the removed-member window shrinks from session lifetime (12h) to cache TTL. Sits under the admin-flag evaluation, so adding/removing someone from `cairn-admins` also applies live. IdP outage → session snapshot stands, 30s negative cache. App-password requests covered; LDAP unchanged (resolves memberOf at bind; its staleness is the credential-cache window, documented). **Dogfood check:** create a space, add a second user, and have them refresh (no re-logout) after ~1 minute — the space should appear. Remove them and their access should vanish within a minute too.
Cordy closed this issue 2026-08-04 10:47:54 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#96
No description provided.