Persist resolved CIMD clients so Redis session rehydration finds them - #6284
Draft
alex-feel wants to merge 1 commit into
Draft
Persist resolved CIMD clients so Redis session rehydration finds them#6284alex-feel wants to merge 1 commit into
alex-feel wants to merge 1 commit into
Conversation
Redis session rehydration resolves the session's client through the bare RedisStorage row lookup, never through the CIMD storage decorator, so a CIMD client that was resolved dynamically at authorize time was not found at the token endpoint and every exchange failed with a bare invalid_grant. Persist the resolved client into the underlying storage on every successful document fetch (best-effort write-through), marked DCR-issued so the row carries the same anti-bloat TTL as DCR registrations. Rehydration then finds the persisted snapshot without a document re-fetch, so established sessions also survive pod restarts and document rotation. The rehydration client lookup now also logs the client id and the wrapped error, which previously left no server-side trace. Closes stacklok#6187 Signed-off-by: Aleksandr Filippov <71711753+alex-feel@users.noreply.github.com>
alex-feel
force-pushed
the
cimd-client-persistence
branch
from
August 16, 2026 01:55
e17c040 to
de0cb7c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6187
Problem
RedisStorage's session rehydration (unmarshalRequester) resolves the session's client through the bare storage's ownGetClientrow lookup — never through theCIMDStorageDecorator. A CIMD client is resolved dynamically at authorize time and never persisted, so at the token endpoint the lookup fails and every exchange for a CIMD client ends in a bareinvalid_grant, with no server-side log line. Memory storage keeps the live client object, so only the CIMD × Redis combination breaks (see #6187 for the analysis and repro).Change
Of the two directions proposed in the issue, this implements the persistence one, as laid out in #6187 (comment):
RegisterClient(write-through; a persistence failure WARN-logs and does not fail the resolution).registration.MarkDCRIssuedgains a*LoopbackClientarm for the loopback-wrapped CIMD shape), so the row carries the same anti-bloat TTL as DCR registrations andRenewClientTTLkeeps actively-used rows alive — unauthenticated/oauth/authorizetraffic can mint these rows, so they must never be permanent.unmarshalRequesternow WARN-logs the client id and the wrapped error when the client lookup fails, so this failure mode is no longer silent server-side.Tests
RegisterClientdoes not fail resolution.Note: #6283 touches other parts of the same decorator file; the two PRs are independent and either can land first.