Repository navigation
Description
Description
Keycloak relies on node-local wall clocks in multiple sensitive paths, including token and assertion validation, cache entry lifetimes, single-use/revoked-token retention, sessions, scheduled cleanup, and cluster or cross-site
event handling. The expected clock-synchronization guarantees and the safety margins that code should apply are not defined in one place. Individual implementations therefore use local constants and different approaches to
clock skew.
The system should warn when the clock-skew is off.
Add a shared cluster clock-skew facility that:
- Defines the supported clock-skew assumptions and warning thresholds centrally.
- Estimates clock differences between active Keycloak nodes and reports excessive skew.
- Exposes reusable functionality for code that calculates absolute expiry times or relative cache lifetimes.
- Documents the clock-synchronization requirements for clustered and multi-site deployments
Value Proposition
Clock skew can create subtle correctness and security failures that are difficult for operators to diagnose. For example, a marker created on a fast node can expire while a slow node still considers the corresponding token or
SAML assertion valid. Excessive skew has also affected cross-cluster invalidation targeting in #52649.
Detection and observability would let operators correct NTP or infrastructure problems before they cause intermittent login failures, replay windows, premature expiry, missed invalidations, or delayed cleanup. Shared constants
and expiry helpers would also prevent each subsystem from independently implementing incomplete or inconsistent safety margins.
Non-Goals
- Multi-Cluster v1 setups
- Detecting time differences across multiple cluster in multi-cluster v2 setups
- Adjusting an operating system clock or replacing NTP/chrony.
- Compensating for any clock drift.
- Treating approximate application-level measurements as a trusted time source.
- Making authentication or cluster availability depend on a single transient measurement by default.
- Making the clock skew part of the health probe
- Automatically changing protocol-level clock-skew settings such as an identity provider's allowed clock skew.
- Solving database-server clock differences unless the selected design explicitly uses database time as a reference
Sub-issues
Collapse Sub-issuesSub-issues
Metadata
Metadata
Assignees
Labels
Type
Fields
Value
Effort
Votes
Projects
- StatusShow more project fieldsOpen
Activity