Loading
feat(oauth): add gRPC endpoint to upsert replicated refresh tokens
Why
Enables gitlab-rails to replicate Doorkeeper refresh tokens into IAM during the OAuth migration.
What
- Adds
InternalOAuthRefreshTokensService.UpsertgRPC endpoint (gitlab-org/gitlab#632066 (closed)). - Upsert semantics: insert-or-revoke. Only
activeis mutable and only flips to false, preventing out-of-order redelivery from un-revoking tokens (sticky revoke). signatureuses Doorkeeper's SHA-512 digest (128 hex), shaped distinctly from fosite's native base64url HMAC to avoid primary-key collisions.expires_atoptional on wire (Doorkeeper tokens don't expire); absent = NULL.- Security:
storage.GetRefreshTokenSessionrejects replicated-shaped signatures before DB query, blocking stolen native tokens from reaching replicated rows via fosite's refresh/revoke/introspect flows or destroying revoke tombstones. - Backfill of existing Doorkeeper tokens out of scope; owned by the periodic reconciliation worker (gitlab-org/gitlab#602679 (closed)). This MR provides steady-state replication via the Upsert endpoint; the worker will reuse it for backfill.
Related to: gitlab-org/gitlab#632066 (closed)
Verification
Build, vet, unit tests, sqlc diff, verify-agent-docs, and full integration suites green on Postgres and YugabyteDB (!706 (merged) dependency resolved; previously skipped tests now pass).
Edited by Daniele Bracciani