Repository navigation
Add DeleteOIDCAuthRequest so SSO state tokens can be single-use - #3
Open
neilLasrado wants to merge 1 commit into
Open
neilLasrado wants to merge 1 commit into
neilLasrado wants to merge 1 commit into
Conversation
Storage had CreateOIDCAuthRequest and GetOIDCAuthRequest but no delete for any SSO auth request type; upstream relies on TTL expiry alone. An OIDC implementation needs to delete the request on read so a state token cannot be replayed within its TTL window. Adds DeleteOIDCAuthRequest to IdentityService and to the services.Identity interface, using the same backend key construction and error conventions as the neighbouring Get. local.IdentityService is the only concrete implementer of services.Identity, so no other type required changes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This branch has not been deployed
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.
Slice 1 of 6 toward self-hosted Google login. Standalone and additive — nothing calls the new method yet.
Why
lib/services/local/users.gohasCreateOIDCAuthRequestandGetOIDCAuthRequestbut no delete, and there is noDelete*AuthRequestfor any SSO type in the tree. Upstream relies on TTL expiry alone.That is not sufficient for the OIDC implementation landing in a later slice. The
statetoken must be single-use: looked up once, then deleted immediately. Without a delete, a captured state token stays replayable for the whole TTL window.Change
Same backend key construction as the neighbouring
GetOIDCAuthRequest, same error-wrapping convention as the siblingDeleteWebauthnSessionData/DeleteMFASessionData. Added to theservices.Identityinterface directly belowGetOIDCAuthRequest.Interface change — other implementers checked
Adding a method to
services.Identitycan break anything that satisfies it, so this was checked rather than assumed.local.IdentityServiceis the only concrete implementer. Everything else (lib/authz/permissions_test.go,lib/services/local/suite_test.go, and thehealthcheckconfigv1/delegationv1/usersv1service tests) holds the interface as a field populated with a*local.IdentityServiceat runtime, so they auto-satisfy.lib/auth/auth_with_roles.go,lib/auth/grpcserver.goandapi/client/client.goalso referenceGetOIDCAuthRequest, but via the unrelatedauthclient.ClientIgRPC interface — no type there implementsservices.Identity.Tests
TestIdentityService_OIDCAuthRequestCRUD— create, get, delete, get-returns-NotFound, plus delete-of-nonexistent and empty-tokenBadParameter.TestIdentityService_OIDCAuthRequestTTLExpiry—clockwork.NewFakeClock()withclock.Advance, matching the surrounding tests.Verification
Scoped builds only (
GOFLAGS=-p=2 GOMAXPROCS=2, never./...):go vetclean on./lib/services/local/,./lib/services/,./lib/authz/, and the threelib/auth/*v1/service-test packagesgo build ./lib/services/— cleango test ./lib/services/local/— the full existing suite in the touched package,okin 11.4s, nothing regressedThat last one matters: Slice 0 was described as a "safe no-op" and turned out to break nine subtests in another package, caught only by running the existing tests. Same check was applied here deliberately.
🤖 Generated with Claude Code