From 6be92f92fb502b95a10a39c181cdefc632fd119e Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Wed, 8 May 2024 11:53:22 -0700 Subject: [PATCH] bump Supervisor session storage versions --- .../controller/supervisorstorage/garbage_collector_test.go | 2 +- internal/fositestorage/accesstoken/accesstoken.go | 3 ++- internal/fositestorage/accesstoken/accesstoken_test.go | 2 +- .../fositestorage/authorizationcode/authorizationcode.go | 5 +++-- .../authorizationcode/authorizationcode_test.go | 2 +- internal/fositestorage/openidconnect/openidconnect.go | 3 ++- internal/fositestorage/openidconnect/openidconnect_test.go | 2 +- internal/fositestorage/pkce/pkce.go | 3 ++- internal/fositestorage/pkce/pkce_test.go | 2 +- internal/fositestorage/refreshtoken/refreshtoken.go | 3 ++- internal/fositestorage/refreshtoken/refreshtoken_test.go | 2 +- test/integration/supervisor_storage_test.go | 2 +- 12 files changed, 18 insertions(+), 13 deletions(-) diff --git a/internal/controller/supervisorstorage/garbage_collector_test.go b/internal/controller/supervisorstorage/garbage_collector_test.go index c020ba92e..903ee7753 100644 --- a/internal/controller/supervisorstorage/garbage_collector_test.go +++ b/internal/controller/supervisorstorage/garbage_collector_test.go @@ -122,7 +122,7 @@ func TestGarbageCollectorControllerSync(t *testing.T) { spec.Run(t, "Sync", func(t *testing.T, when spec.G, it spec.S) { const ( installedInNamespace = "some-namespace" - currentSessionStorageVersion = "7" // update this when you update the storage version in the production code + currentSessionStorageVersion = "8" // update this when you update the storage version in the production code ) var ( diff --git a/internal/fositestorage/accesstoken/accesstoken.go b/internal/fositestorage/accesstoken/accesstoken.go index c67b9cab7..bb712c336 100644 --- a/internal/fositestorage/accesstoken/accesstoken.go +++ b/internal/fositestorage/accesstoken/accesstoken.go @@ -35,7 +35,8 @@ const ( // Version 5 is when we added the UpstreamUsername and UpstreamGroups fields to psession.CustomSessionData. // Version 6 is when we upgraded fosite in Dec 2023. // Version 7 is when OIDCClients were given configurable ID token lifetimes. - accessTokenStorageVersion = "7" + // Version 8 is when GitHubIdentityProvider was added. + accessTokenStorageVersion = "8" ) type RevocationStorage interface { diff --git a/internal/fositestorage/accesstoken/accesstoken_test.go b/internal/fositestorage/accesstoken/accesstoken_test.go index 522c24c90..3d0abbc57 100644 --- a/internal/fositestorage/accesstoken/accesstoken_test.go +++ b/internal/fositestorage/accesstoken/accesstoken_test.go @@ -30,7 +30,7 @@ import ( const ( namespace = "test-ns" - expectedVersion = "7" // update this when you update the storage version in the production code + expectedVersion = "8" // update this when you update the storage version in the production code ) var ( diff --git a/internal/fositestorage/authorizationcode/authorizationcode.go b/internal/fositestorage/authorizationcode/authorizationcode.go index a29b0663b..283a4f987 100644 --- a/internal/fositestorage/authorizationcode/authorizationcode.go +++ b/internal/fositestorage/authorizationcode/authorizationcode.go @@ -36,7 +36,8 @@ const ( // Version 5 is when we added the UpstreamUsername and UpstreamGroups fields to psession.CustomSessionData. // Version 6 is when we upgraded fosite in Dec 2023. // Version 7 is when OIDCClients were given configurable ID token lifetimes. - authorizeCodeStorageVersion = "7" + // Version 8 is when GitHubIdentityProvider was added. + authorizeCodeStorageVersion = "8" ) var _ oauth2.AuthorizeCodeStorage = &authorizeCodeStorage{} @@ -397,5 +398,5 @@ const ExpectedAuthorizeCodeSessionJSONFromFuzzing = `{ "姧骦:駝重EȫʆɵʮGɃ" ] }, - "version": "7" + "version": "8" }` diff --git a/internal/fositestorage/authorizationcode/authorizationcode_test.go b/internal/fositestorage/authorizationcode/authorizationcode_test.go index a95d0e970..437f9b227 100644 --- a/internal/fositestorage/authorizationcode/authorizationcode_test.go +++ b/internal/fositestorage/authorizationcode/authorizationcode_test.go @@ -43,7 +43,7 @@ import ( const ( namespace = "test-ns" - expectedVersion = "7" // update this when you update the storage version in the production code + expectedVersion = "8" // update this when you update the storage version in the production code ) var ( diff --git a/internal/fositestorage/openidconnect/openidconnect.go b/internal/fositestorage/openidconnect/openidconnect.go index a04bea4c3..1aa568321 100644 --- a/internal/fositestorage/openidconnect/openidconnect.go +++ b/internal/fositestorage/openidconnect/openidconnect.go @@ -36,7 +36,8 @@ const ( // Version 5 is when we added the UpstreamUsername and UpstreamGroups fields to psession.CustomSessionData. // Version 6 is when we upgraded fosite in Dec 2023. // Version 7 is when OIDCClients were given configurable ID token lifetimes. - oidcStorageVersion = "7" + // Version 8 is when GitHubIdentityProvider was added. + oidcStorageVersion = "8" ) var _ openid.OpenIDConnectRequestStorage = &openIDConnectRequestStorage{} diff --git a/internal/fositestorage/openidconnect/openidconnect_test.go b/internal/fositestorage/openidconnect/openidconnect_test.go index 8f64299ed..bcfd10f19 100644 --- a/internal/fositestorage/openidconnect/openidconnect_test.go +++ b/internal/fositestorage/openidconnect/openidconnect_test.go @@ -29,7 +29,7 @@ import ( const ( namespace = "test-ns" - expectedVersion = "7" // update this when you update the storage version in the production code + expectedVersion = "8" // update this when you update the storage version in the production code ) var ( diff --git a/internal/fositestorage/pkce/pkce.go b/internal/fositestorage/pkce/pkce.go index b0d371b6a..78091d8d4 100644 --- a/internal/fositestorage/pkce/pkce.go +++ b/internal/fositestorage/pkce/pkce.go @@ -34,7 +34,8 @@ const ( // Version 5 is when we added the UpstreamUsername and UpstreamGroups fields to psession.CustomSessionData. // Version 6 is when we upgraded fosite in Dec 2023. // Version 7 is when OIDCClients were given configurable ID token lifetimes. - pkceStorageVersion = "7" + // Version 8 is when GitHubIdentityProvider was added. + pkceStorageVersion = "8" ) var _ pkce.PKCERequestStorage = &pkceStorage{} diff --git a/internal/fositestorage/pkce/pkce_test.go b/internal/fositestorage/pkce/pkce_test.go index ed38d51f6..10fd61955 100644 --- a/internal/fositestorage/pkce/pkce_test.go +++ b/internal/fositestorage/pkce/pkce_test.go @@ -29,7 +29,7 @@ import ( const ( namespace = "test-ns" - expectedVersion = "7" // update this when you update the storage version in the production code + expectedVersion = "8" // update this when you update the storage version in the production code ) var ( diff --git a/internal/fositestorage/refreshtoken/refreshtoken.go b/internal/fositestorage/refreshtoken/refreshtoken.go index efc96071b..20e3f759c 100644 --- a/internal/fositestorage/refreshtoken/refreshtoken.go +++ b/internal/fositestorage/refreshtoken/refreshtoken.go @@ -35,7 +35,8 @@ const ( // Version 5 is when we added the UpstreamUsername and UpstreamGroups fields to psession.CustomSessionData. // Version 6 is when we upgraded fosite in Dec 2023. // Version 7 is when OIDCClients were given configurable ID token lifetimes. - refreshTokenStorageVersion = "7" + // Version 8 is when GitHubIdentityProvider was added. + refreshTokenStorageVersion = "8" ) type RevocationStorage interface { diff --git a/internal/fositestorage/refreshtoken/refreshtoken_test.go b/internal/fositestorage/refreshtoken/refreshtoken_test.go index 6075d0723..1944e5737 100644 --- a/internal/fositestorage/refreshtoken/refreshtoken_test.go +++ b/internal/fositestorage/refreshtoken/refreshtoken_test.go @@ -30,7 +30,7 @@ import ( const ( namespace = "test-ns" - expectedVersion = "7" // update this when you update the storage version in the production code + expectedVersion = "8" // update this when you update the storage version in the production code ) var ( diff --git a/test/integration/supervisor_storage_test.go b/test/integration/supervisor_storage_test.go index 9da514620..12171d696 100644 --- a/test/integration/supervisor_storage_test.go +++ b/test/integration/supervisor_storage_test.go @@ -93,7 +93,7 @@ func TestAuthorizeCodeStorage(t *testing.T) { // Note that CreateAuthorizeCodeSession() sets Active to true and also sets the Version before storing the session, // so expect those here. session.Active = true - session.Version = "7" // this is the value of the authorizationcode.authorizeCodeStorageVersion constant + session.Version = "8" // this is the value of the authorizationcode.authorizeCodeStorageVersion constant expectedSessionStorageJSON, err := json.Marshal(session) require.NoError(t, err) require.JSONEq(t, string(expectedSessionStorageJSON), string(initialSecret.Data["pinniped-storage-data"]))