diff --git a/go.work b/go.work index a345ebf231..5adfedcf44 100644 --- a/go.work +++ b/go.work @@ -1,4 +1,4 @@ -go 1.23.0 +go 1.24.0 toolchain go1.24.2 diff --git a/service/authorization/authorization_test.go b/service/authorization/authorization_test.go index 34ce530fde..552741660a 100644 --- a/service/authorization/authorization_test.go +++ b/service/authorization/authorization_test.go @@ -246,8 +246,6 @@ func Test_GetDecisionsAllOf_Pass(t *testing.T) { }, } - ctxb := context.Background() - testrego := rego.New( rego.Query("data.example.p"), rego.Module("example.rego", @@ -256,7 +254,7 @@ func Test_GetDecisionsAllOf_Pass(t *testing.T) { )) // Run evaluation. - prepared, err := testrego.PrepareForEval(ctxb) + prepared, err := testrego.PrepareForEval(t.Context()) require.NoError(t, err) // set the request @@ -289,7 +287,7 @@ func Test_GetDecisionsAllOf_Pass(t *testing.T) { eval: prepared, } - resp, err := as.GetDecisions(ctxb, &req) + resp, err := as.GetDecisions(t.Context(), &req) require.NoError(t, err) assert.NotNil(t, resp) @@ -351,12 +349,12 @@ func Test_GetDecisionsAllOf_Pass(t *testing.T) { )) // Run evaluation. - prepared, err = testrego.PrepareForEval(ctxb) + prepared, err = testrego.PrepareForEval(t.Context()) require.NoError(t, err) as.eval = prepared - resp, err = as.GetDecisions(ctxb, &req) + resp, err = as.GetDecisions(t.Context(), &req) require.NoError(t, err) assert.Len(t, resp.Msg.GetDecisionResponses(), 2) assert.Equal(t, authorization.DecisionResponse_DECISION_PERMIT, resp.Msg.GetDecisionResponses()[0].GetDecision()) @@ -433,8 +431,6 @@ func Test_GetDecisions_AllOf_Fail(t *testing.T) { }, } - ctxb := context.Background() - testrego := rego.New( rego.Query("data.example.p"), rego.Module("example.rego", @@ -443,7 +439,7 @@ func Test_GetDecisions_AllOf_Fail(t *testing.T) { )) // Run evaluation. - prepared, err := testrego.PrepareForEval(ctxb) + prepared, err := testrego.PrepareForEval(t.Context()) require.NoError(t, err) as := AuthorizationService{ @@ -454,7 +450,7 @@ func Test_GetDecisions_AllOf_Fail(t *testing.T) { eval: prepared, } - resp, err := as.GetDecisions(ctxb, &req) + resp, err := as.GetDecisions(t.Context(), &req) require.NoError(t, err) assert.NotNil(t, resp) @@ -509,8 +505,6 @@ func Test_GetDecisionsAllOfWithEnvironmental_Pass(t *testing.T) { }, } - ctxb := context.Background() - testrego := rego.New( rego.Query("data.example.p"), rego.Module("example.rego", @@ -519,7 +513,7 @@ func Test_GetDecisionsAllOfWithEnvironmental_Pass(t *testing.T) { )) // Run evaluation. - prepared, err := testrego.PrepareForEval(ctxb) + prepared, err := testrego.PrepareForEval(t.Context()) require.NoError(t, err) // set the request @@ -553,7 +547,7 @@ func Test_GetDecisionsAllOfWithEnvironmental_Pass(t *testing.T) { eval: prepared, } - resp, err := as.GetDecisions(ctxb, &req) + resp, err := as.GetDecisions(t.Context(), &req) require.NoError(t, err) assert.NotNil(t, resp) @@ -605,8 +599,6 @@ func Test_GetDecisionsAllOfWithEnvironmental_Fail(t *testing.T) { }, } - ctxb := context.Background() - testrego := rego.New( rego.Query("data.example.p"), rego.Module("example.rego", @@ -615,7 +607,7 @@ func Test_GetDecisionsAllOfWithEnvironmental_Fail(t *testing.T) { )) // Run evaluation. - prepared, err := testrego.PrepareForEval(ctxb) + prepared, err := testrego.PrepareForEval(t.Context()) require.NoError(t, err) // set the request @@ -649,7 +641,7 @@ func Test_GetDecisionsAllOfWithEnvironmental_Fail(t *testing.T) { eval: prepared, } - resp, err := as.GetDecisions(ctxb, &req) + resp, err := as.GetDecisions(t.Context(), &req) require.NoError(t, err) assert.NotNil(t, resp) @@ -702,8 +694,6 @@ func Test_GetEntitlementsSimple(t *testing.T) { }, } - ctxb := context.Background() - rego := rego.New( rego.Query("data.example.p"), rego.Module("example.rego", @@ -712,7 +702,7 @@ func Test_GetEntitlementsSimple(t *testing.T) { )) // Run evaluation. - prepared, err := rego.PrepareForEval(ctxb) + prepared, err := rego.PrepareForEval(t.Context()) require.NoError(t, err) as := AuthorizationService{ @@ -730,7 +720,7 @@ func Test_GetEntitlementsSimple(t *testing.T) { }, } - resp, err := as.GetEntitlements(ctxb, &req) + resp, err := as.GetEntitlements(t.Context(), &req) require.NoError(t, err) assert.NotNil(t, resp) @@ -775,8 +765,6 @@ func Test_GetEntitlementsFqnCasing(t *testing.T) { }, } - ctxb := context.Background() - rego := rego.New( rego.Query("data.example.p"), rego.Module("example.rego", @@ -785,7 +773,7 @@ func Test_GetEntitlementsFqnCasing(t *testing.T) { )) // Run evaluation. - prepared, err := rego.PrepareForEval(ctxb) + prepared, err := rego.PrepareForEval(t.Context()) require.NoError(t, err) as := AuthorizationService{ @@ -808,7 +796,7 @@ func Test_GetEntitlementsFqnCasing(t *testing.T) { assert.Equal(t, fqn, strings.ToLower(fqn)) } - resp, err := as.GetEntitlements(ctxb, &req) + resp, err := as.GetEntitlements(t.Context(), &req) require.NoError(t, err) assert.NotNil(t, resp) @@ -853,8 +841,6 @@ func Test_GetEntitlements_HandlesPagination(t *testing.T) { }, } - ctxb := context.Background() - rego := rego.New( rego.Query("data.example.p"), rego.Module("example.rego", @@ -863,7 +849,7 @@ func Test_GetEntitlements_HandlesPagination(t *testing.T) { )) // Run evaluation. - prepared, err := rego.PrepareForEval(ctxb) + prepared, err := rego.PrepareForEval(t.Context()) require.NoError(t, err) as := AuthorizationService{ @@ -887,7 +873,7 @@ func Test_GetEntitlements_HandlesPagination(t *testing.T) { assert.Equal(t, fqn, strings.ToLower(fqn)) } - resp, err := as.GetEntitlements(ctxb, &req) + resp, err := as.GetEntitlements(t.Context(), &req) require.NoError(t, err) assert.NotNil(t, resp) @@ -946,8 +932,6 @@ func Test_GetEntitlementsWithComprehensiveHierarchy(t *testing.T) { }, } - ctxb := context.Background() - rego := rego.New( rego.Query("data.example.p"), rego.Module("example.rego", @@ -956,7 +940,7 @@ func Test_GetEntitlementsWithComprehensiveHierarchy(t *testing.T) { )) // Run evaluation. - prepared, err := rego.PrepareForEval(ctxb) + prepared, err := rego.PrepareForEval(t.Context()) require.NoError(t, err) as := AuthorizationService{ logger: logger, sdk: &otdf.SDK{ @@ -975,7 +959,7 @@ func Test_GetEntitlementsWithComprehensiveHierarchy(t *testing.T) { }, } - resp, err := as.GetEntitlements(ctxb, &req) + resp, err := as.GetEntitlements(t.Context(), &req) require.NoError(t, err) assert.NotNil(t, resp) @@ -1186,8 +1170,6 @@ func Test_GetDecisions_RA_FQN_Edge_Cases(t *testing.T) { }, } - ctxb := context.Background() - testrego := rego.New( rego.Query("data.example.p"), rego.Module("example.rego", @@ -1196,7 +1178,7 @@ func Test_GetDecisions_RA_FQN_Edge_Cases(t *testing.T) { )) // Run evaluation. - prepared, err := testrego.PrepareForEval(ctxb) + prepared, err := testrego.PrepareForEval(t.Context()) require.NoError(t, err) as := AuthorizationService{ @@ -1235,7 +1217,7 @@ func Test_GetDecisions_RA_FQN_Edge_Cases(t *testing.T) { }, } - resp, err := as.GetDecisions(ctxb, &req) + resp, err := as.GetDecisions(t.Context(), &req) require.NoError(t, err) assert.NotNil(t, resp) @@ -1271,7 +1253,7 @@ func Test_GetDecisions_RA_FQN_Edge_Cases(t *testing.T) { }, } - resp, err = as.GetDecisions(ctxb, &req) + resp, err = as.GetDecisions(t.Context(), &req) require.NoError(t, err) assert.NotNil(t, resp) @@ -1307,7 +1289,7 @@ func Test_GetDecisions_RA_FQN_Edge_Cases(t *testing.T) { }, } - resp, err = as.GetDecisions(ctxb, &req) + resp, err = as.GetDecisions(t.Context(), &req) require.NoError(t, err) assert.NotNil(t, resp) @@ -1358,8 +1340,6 @@ func Test_GetDecisionsAllOf_Pass_EC_RA_Length_Mismatch(t *testing.T) { }, } - ctxb := context.Background() - /////// TEST1: Three entity chains, one resource attribute /////// testrego := rego.New( rego.Query("data.example.p"), @@ -1369,7 +1349,7 @@ func Test_GetDecisionsAllOf_Pass_EC_RA_Length_Mismatch(t *testing.T) { )) // Run evaluation. - prepared, err := testrego.PrepareForEval(ctxb) + prepared, err := testrego.PrepareForEval(t.Context()) require.NoError(t, err) // set the request @@ -1414,7 +1394,7 @@ func Test_GetDecisionsAllOf_Pass_EC_RA_Length_Mismatch(t *testing.T) { eval: prepared, } - resp, err := as.GetDecisions(ctxb, &req) + resp, err := as.GetDecisions(t.Context(), &req) require.NoError(t, err) assert.NotNil(t, resp) @@ -1487,12 +1467,12 @@ func Test_GetDecisionsAllOf_Pass_EC_RA_Length_Mismatch(t *testing.T) { )) // Run evaluation. - prepared, err = testrego.PrepareForEval(ctxb) + prepared, err = testrego.PrepareForEval(t.Context()) require.NoError(t, err) as.eval = prepared - resp, err = as.GetDecisions(ctxb, &req) + resp, err = as.GetDecisions(t.Context(), &req) require.NoError(t, err) assert.Len(t, resp.Msg.GetDecisionResponses(), 6) @@ -1556,12 +1536,12 @@ func Test_GetDecisionsAllOf_Pass_EC_RA_Length_Mismatch(t *testing.T) { )) // Run evaluation. - prepared, err = testrego.PrepareForEval(ctxb) + prepared, err = testrego.PrepareForEval(t.Context()) require.NoError(t, err) as.eval = prepared - resp, err = as.GetDecisions(ctxb, &req) + resp, err = as.GetDecisions(t.Context(), &req) require.NoError(t, err) assert.Len(t, resp.Msg.GetDecisionResponses(), 3) assert.Equal(t, "ec1", resp.Msg.GetDecisionResponses()[0].GetEntityChainId()) @@ -1605,7 +1585,7 @@ func Test_GetDecisionsAllOf_Pass_EC_RA_Length_Mismatch(t *testing.T) { }, } - resp, err = as.GetDecisions(ctxb, &req) + resp, err = as.GetDecisions(t.Context(), &req) require.NoError(t, err) assert.Len(t, resp.Msg.GetDecisionResponses(), 6) assert.Equal(t, "ec1", resp.Msg.GetDecisionResponses()[0].GetEntityChainId()) @@ -1671,8 +1651,6 @@ func Test_GetDecisions_Empty_EC_RA(t *testing.T) { }, } - ctxb := context.Background() - testrego := rego.New( rego.Query("data.example.p"), rego.Module("example.rego", @@ -1681,7 +1659,7 @@ func Test_GetDecisions_Empty_EC_RA(t *testing.T) { )) // Run evaluation. - prepared, err := testrego.PrepareForEval(ctxb) + prepared, err := testrego.PrepareForEval(t.Context()) require.NoError(t, err) as := AuthorizationService{ @@ -1814,7 +1792,7 @@ func Test_GetDecisions_Empty_EC_RA(t *testing.T) { ///////////// Run tests ///////////////////// for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { - resp, err := as.GetDecisions(ctxb, &tc.req) + resp, err := as.GetDecisions(t.Context(), &tc.req) require.NoError(t, err) assert.NotNil(t, resp) assert.Len(t, resp.Msg.GetDecisionResponses(), tc.numDecisions) diff --git a/service/entityresolution/claims/claims_entity_resolution_test.go b/service/entityresolution/claims/claims_entity_resolution_test.go index 3354d8f332..a9444852f4 100644 --- a/service/entityresolution/claims/claims_entity_resolution_test.go +++ b/service/entityresolution/claims/claims_entity_resolution_test.go @@ -1,7 +1,6 @@ package entityresolution_test import ( - "context" "testing" "github.com/opentdf/platform/protocol/go/authorization" @@ -20,12 +19,10 @@ func Test_ClientResolveEntity(t *testing.T) { var validBody []*authorization.Entity validBody = append(validBody, &authorization.Entity{Id: "1234", EntityType: &authorization.Entity_ClientId{ClientId: "random"}}) - var ctxb = context.Background() - var req = entityresolution.ResolveEntitiesRequest{} req.Entities = validBody - var resp, reserr = claims.EntityResolution(ctxb, &req, logger.CreateTestLogger()) + var resp, reserr = claims.EntityResolution(t.Context(), &req, logger.CreateTestLogger()) require.NoError(t, reserr) @@ -44,12 +41,10 @@ func Test_EmailResolveEntity(t *testing.T) { var validBody []*authorization.Entity validBody = append(validBody, &authorization.Entity{Id: "1234", EntityType: &authorization.Entity_EmailAddress{EmailAddress: "random"}}) - var ctxb = context.Background() - var req = entityresolution.ResolveEntitiesRequest{} req.Entities = validBody - var resp, reserr = claims.EntityResolution(ctxb, &req, logger.CreateTestLogger()) + var resp, reserr = claims.EntityResolution(t.Context(), &req, logger.CreateTestLogger()) require.NoError(t, reserr) @@ -80,12 +75,10 @@ func Test_ClaimsResolveEntity(t *testing.T) { var validBody []*authorization.Entity validBody = append(validBody, &authorization.Entity{Id: "1234", EntityType: &authorization.Entity_Claims{Claims: anyClaims}}) - var ctxb = context.Background() - var req = entityresolution.ResolveEntitiesRequest{} req.Entities = validBody - var resp, reserr = claims.EntityResolution(ctxb, &req, logger.CreateTestLogger()) + var resp, reserr = claims.EntityResolution(t.Context(), &req, logger.CreateTestLogger()) require.NoError(t, reserr) @@ -101,11 +94,9 @@ func Test_ClaimsResolveEntity(t *testing.T) { } func Test_JWTToEntityChainClaims(t *testing.T) { - var ctxb = context.Background() - validBody := []*authorization.Token{{Jwt: samplejwt}} - var resp, reserr = claims.CreateEntityChainFromJwt(ctxb, &entityresolution.CreateEntityChainFromJwtRequest{Tokens: validBody}, logger.CreateTestLogger()) + var resp, reserr = claims.CreateEntityChainFromJwt(t.Context(), &entityresolution.CreateEntityChainFromJwtRequest{Tokens: validBody}, logger.CreateTestLogger()) require.NoError(t, reserr) diff --git a/service/entityresolution/keycloak/keycloak_entity_resolution_test.go b/service/entityresolution/keycloak/keycloak_entity_resolution_test.go index b41d35bed9..0b2fb2478e 100644 --- a/service/entityresolution/keycloak/keycloak_entity_resolution_test.go +++ b/service/entityresolution/keycloak/keycloak_entity_resolution_test.go @@ -1,7 +1,6 @@ package entityresolution_test import ( - "context" "encoding/json" "io" "net/http" @@ -149,8 +148,6 @@ func Test_KCEntityResolutionByClientId(t *testing.T) { var validBody []*authorization.Entity validBody = append(validBody, &authorization.Entity{Id: "1234", EntityType: &authorization.Entity_ClientId{ClientId: "opentdf"}}) - ctxb := context.Background() - req := entityresolution.ResolveEntitiesRequest{} req.Entities = validBody csqr := map[string]string{ @@ -160,7 +157,7 @@ func Test_KCEntityResolutionByClientId(t *testing.T) { defer server.Close() kcconfig := testKeycloakConfig(server) - resp, reserr := keycloak.EntityResolution(ctxb, &req, kcconfig, logger.CreateTestLogger()) + resp, reserr := keycloak.EntityResolution(t.Context(), &req, kcconfig, logger.CreateTestLogger()) require.NoError(t, reserr) _ = json.NewEncoder(os.Stdout).Encode(&resp) @@ -182,12 +179,10 @@ func Test_KCEntityResolutionByEmail(t *testing.T) { kcconfig := testKeycloakConfig(server) - ctxb := context.Background() - req := entityresolution.ResolveEntitiesRequest{} req.Entities = validBody - resp, reserr := keycloak.EntityResolution(ctxb, &req, kcconfig, logger.CreateTestLogger()) + resp, reserr := keycloak.EntityResolution(t.Context(), &req, kcconfig, logger.CreateTestLogger()) require.NoError(t, reserr) @@ -220,12 +215,10 @@ func Test_KCEntityResolutionByUsername(t *testing.T) { kcconfig := testKeycloakConfig(server) - ctxb := context.Background() - req := entityresolution.ResolveEntitiesRequest{} req.Entities = validBody - resp, reserr := keycloak.EntityResolution(ctxb, &req, kcconfig, logger.CreateTestLogger()) + resp, reserr := keycloak.EntityResolution(t.Context(), &req, kcconfig, logger.CreateTestLogger()) require.NoError(t, reserr) @@ -262,12 +255,10 @@ func Test_KCEntityResolutionByGroupEmail(t *testing.T) { kcconfig := testKeycloakConfig(server) - ctxb := context.Background() - req := entityresolution.ResolveEntitiesRequest{} req.Entities = validBody - resp, reserr := keycloak.EntityResolution(ctxb, &req, kcconfig, logger.CreateTestLogger()) + resp, reserr := keycloak.EntityResolution(t.Context(), &req, kcconfig, logger.CreateTestLogger()) require.NoError(t, reserr) @@ -300,12 +291,10 @@ func Test_KCEntityResolutionNotFoundError(t *testing.T) { kcconfig := testKeycloakConfig(server) - ctxb := context.Background() - req := entityresolution.ResolveEntitiesRequest{} req.Entities = validBody - resp, reserr := keycloak.EntityResolution(ctxb, &req, kcconfig, logger.CreateTestLogger()) + resp, reserr := keycloak.EntityResolution(t.Context(), &req, kcconfig, logger.CreateTestLogger()) require.Error(t, reserr) assert.Equal(t, &entityresolution.ResolveEntitiesResponse{}, &resp) @@ -323,11 +312,9 @@ func Test_JwtClientAndUsernameClientCredentials(t *testing.T) { kcconfig := testKeycloakConfig(server) - ctxb := context.Background() - validBody := []*authorization.Token{{Jwt: clientCredentialsJwt}} - resp, reserr := keycloak.CreateEntityChainFromJwt(ctxb, &entityresolution.CreateEntityChainFromJwtRequest{Tokens: validBody}, kcconfig, logger.CreateTestLogger()) + resp, reserr := keycloak.CreateEntityChainFromJwt(t.Context(), &entityresolution.CreateEntityChainFromJwtRequest{Tokens: validBody}, kcconfig, logger.CreateTestLogger()) require.NoError(t, reserr) @@ -345,11 +332,9 @@ func Test_JwtClientAndUsernamePasswordPub(t *testing.T) { kcconfig := testKeycloakConfig(server) - ctxb := context.Background() - validBody := []*authorization.Token{{Jwt: passwordPubClientJwt}} - resp, reserr := keycloak.CreateEntityChainFromJwt(ctxb, &entityresolution.CreateEntityChainFromJwtRequest{Tokens: validBody}, kcconfig, logger.CreateTestLogger()) + resp, reserr := keycloak.CreateEntityChainFromJwt(t.Context(), &entityresolution.CreateEntityChainFromJwtRequest{Tokens: validBody}, kcconfig, logger.CreateTestLogger()) require.NoError(t, reserr) @@ -367,11 +352,9 @@ func Test_JwtClientAndUsernamePasswordPriv(t *testing.T) { kcconfig := testKeycloakConfig(server) - ctxb := context.Background() - validBody := []*authorization.Token{{Jwt: passwordPrivClientJwt}} - resp, reserr := keycloak.CreateEntityChainFromJwt(ctxb, &entityresolution.CreateEntityChainFromJwtRequest{Tokens: validBody}, kcconfig, logger.CreateTestLogger()) + resp, reserr := keycloak.CreateEntityChainFromJwt(t.Context(), &entityresolution.CreateEntityChainFromJwtRequest{Tokens: validBody}, kcconfig, logger.CreateTestLogger()) require.NoError(t, reserr) @@ -389,11 +372,9 @@ func Test_JwtClientAndUsernameAuthPub(t *testing.T) { kcconfig := testKeycloakConfig(server) - ctxb := context.Background() - validBody := []*authorization.Token{{Jwt: authPubClientJwt}} - resp, reserr := keycloak.CreateEntityChainFromJwt(ctxb, &entityresolution.CreateEntityChainFromJwtRequest{Tokens: validBody}, kcconfig, logger.CreateTestLogger()) + resp, reserr := keycloak.CreateEntityChainFromJwt(t.Context(), &entityresolution.CreateEntityChainFromJwtRequest{Tokens: validBody}, kcconfig, logger.CreateTestLogger()) require.NoError(t, reserr) @@ -411,11 +392,9 @@ func Test_JwtClientAndUsernameAuthPriv(t *testing.T) { kcconfig := testKeycloakConfig(server) - ctxb := context.Background() - validBody := []*authorization.Token{{Jwt: authPrivClientJwt}} - resp, reserr := keycloak.CreateEntityChainFromJwt(ctxb, &entityresolution.CreateEntityChainFromJwtRequest{Tokens: validBody}, kcconfig, logger.CreateTestLogger()) + resp, reserr := keycloak.CreateEntityChainFromJwt(t.Context(), &entityresolution.CreateEntityChainFromJwtRequest{Tokens: validBody}, kcconfig, logger.CreateTestLogger()) require.NoError(t, reserr) @@ -433,11 +412,9 @@ func Test_JwtClientAndUsernameImplicitPub(t *testing.T) { kcconfig := testKeycloakConfig(server) - ctxb := context.Background() - validBody := []*authorization.Token{{Jwt: implicitPubClientJwt}} - resp, reserr := keycloak.CreateEntityChainFromJwt(ctxb, &entityresolution.CreateEntityChainFromJwtRequest{Tokens: validBody}, kcconfig, logger.CreateTestLogger()) + resp, reserr := keycloak.CreateEntityChainFromJwt(t.Context(), &entityresolution.CreateEntityChainFromJwtRequest{Tokens: validBody}, kcconfig, logger.CreateTestLogger()) require.NoError(t, reserr) @@ -455,11 +432,9 @@ func Test_JwtClientAndUsernameImplicitPriv(t *testing.T) { kcconfig := testKeycloakConfig(server) - ctxb := context.Background() - validBody := []*authorization.Token{{Jwt: implicitPrivClientJwt}} - resp, reserr := keycloak.CreateEntityChainFromJwt(ctxb, &entityresolution.CreateEntityChainFromJwtRequest{Tokens: validBody}, kcconfig, logger.CreateTestLogger()) + resp, reserr := keycloak.CreateEntityChainFromJwt(t.Context(), &entityresolution.CreateEntityChainFromJwtRequest{Tokens: validBody}, kcconfig, logger.CreateTestLogger()) require.NoError(t, reserr) @@ -480,11 +455,9 @@ func Test_JwtClientAndClientTokenExchange(t *testing.T) { kcconfig := testKeycloakConfig(server) - ctxb := context.Background() - validBody := []*authorization.Token{{Jwt: tokenExchangeJwt}} - resp, reserr := keycloak.CreateEntityChainFromJwt(ctxb, &entityresolution.CreateEntityChainFromJwtRequest{Tokens: validBody}, kcconfig, logger.CreateTestLogger()) + resp, reserr := keycloak.CreateEntityChainFromJwt(t.Context(), &entityresolution.CreateEntityChainFromJwtRequest{Tokens: validBody}, kcconfig, logger.CreateTestLogger()) require.NoError(t, reserr) @@ -505,11 +478,9 @@ func Test_JwtMultiple(t *testing.T) { kcconfig := testKeycloakConfig(server) - ctxb := context.Background() - validBody := []*authorization.Token{{Jwt: tokenExchangeJwt, Id: "tok1"}, {Jwt: authPrivClientJwt, Id: "tok2"}} - resp, reserr := keycloak.CreateEntityChainFromJwt(ctxb, &entityresolution.CreateEntityChainFromJwtRequest{Tokens: validBody}, kcconfig, logger.CreateTestLogger()) + resp, reserr := keycloak.CreateEntityChainFromJwt(t.Context(), &entityresolution.CreateEntityChainFromJwtRequest{Tokens: validBody}, kcconfig, logger.CreateTestLogger()) require.NoError(t, reserr) @@ -544,12 +515,10 @@ func Test_KCEntityResolutionNotFoundInferEmail(t *testing.T) { kcconfig := testKeycloakConfigInferID(server) - ctxb := context.Background() - req := entityresolution.ResolveEntitiesRequest{} req.Entities = validBody - resp, reserr := keycloak.EntityResolution(ctxb, &req, kcconfig, logger.CreateTestLogger()) + resp, reserr := keycloak.EntityResolution(t.Context(), &req, kcconfig, logger.CreateTestLogger()) require.NoError(t, reserr) @@ -576,12 +545,10 @@ func Test_KCEntityResolutionNotFoundInferClientId(t *testing.T) { kcconfig := testKeycloakConfigInferID(server) - ctxb := context.Background() - req := entityresolution.ResolveEntitiesRequest{} req.Entities = validBody - resp, reserr := keycloak.EntityResolution(ctxb, &req, kcconfig, logger.CreateTestLogger()) + resp, reserr := keycloak.EntityResolution(t.Context(), &req, kcconfig, logger.CreateTestLogger()) require.NoError(t, reserr) @@ -607,12 +574,10 @@ func Test_KCEntityResolutionNotFoundNotInferUsername(t *testing.T) { kcconfig := testKeycloakConfigInferID(server) - ctxb := context.Background() - req := entityresolution.ResolveEntitiesRequest{} req.Entities = validBody - resp, reserr := keycloak.EntityResolution(ctxb, &req, kcconfig, logger.CreateTestLogger()) + resp, reserr := keycloak.EntityResolution(t.Context(), &req, kcconfig, logger.CreateTestLogger()) require.Error(t, reserr) assert.Equal(t, &entityresolution.ResolveEntitiesResponse{}, &resp) diff --git a/service/go.mod b/service/go.mod index 2457db791f..fc2bc8e37d 100644 --- a/service/go.mod +++ b/service/go.mod @@ -1,18 +1,18 @@ module github.com/opentdf/platform/service -go 1.23.0 +go 1.24.0 toolchain go1.24.2 require ( - connectrpc.com/connect v1.17.0 + connectrpc.com/connect v1.18.1 connectrpc.com/grpchealth v1.3.0 connectrpc.com/grpcreflect v1.2.0 - connectrpc.com/validate v0.1.0 + connectrpc.com/validate v0.2.0 github.com/Masterminds/squirrel v1.5.4 github.com/Nerzal/gocloak/v13 v13.9.0 github.com/bmatcuk/doublestar v1.3.4 - github.com/bufbuild/protovalidate-go v0.6.0 + github.com/bufbuild/protovalidate-go v0.9.3 github.com/casbin/casbin/v2 v2.101.0 github.com/creasty/defaults v1.7.0 github.com/docker/docker v27.1.1+incompatible @@ -34,7 +34,7 @@ require ( github.com/pressly/goose/v3 v3.19.1 github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.18.2 - github.com/stretchr/testify v1.9.0 + github.com/stretchr/testify v1.10.0 github.com/testcontainers/testcontainers-go v0.34.0 go.opentelemetry.io/otel v1.31.0 go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 @@ -42,14 +42,16 @@ require ( go.opentelemetry.io/otel/trace v1.31.0 golang.org/x/net v0.36.0 google.golang.org/grpc v1.67.1 - google.golang.org/protobuf v1.35.2 + google.golang.org/protobuf v1.36.6 gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 ) +require cel.dev/expr v0.19.1 // indirect + require ( - buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.34.1-20240508200655-46a4cf4ba109.1 // indirect + buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250307204501-0409229c3780.1 // indirect dario.cat/mergo v1.0.0 // indirect github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect; indi\ @@ -85,7 +87,7 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v5 v5.2.2 // indirect github.com/golang/mock v1.6.0 // indirect - github.com/google/cel-go v0.20.1 // indirect + github.com/google/cel-go v0.24.1 // indirect github.com/google/flatbuffers v23.5.26+incompatible // indirect github.com/gorilla/mux v1.8.1 // indirect github.com/gowebpki/jcs v1.0.1 // indirect @@ -155,11 +157,11 @@ require ( go.opentelemetry.io/otel/metric v1.31.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.35.0 // indirect - golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect + golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect golang.org/x/oauth2 v0.22.0 // indirect - golang.org/x/sync v0.11.0 // indirect + golang.org/x/sync v0.12.0 // indirect golang.org/x/sys v0.30.0 // indirect - golang.org/x/text v0.22.0 // indirect + golang.org/x/text v0.23.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/service/go.sum b/service/go.sum index ff1f614593..171bf6e27a 100644 --- a/service/go.sum +++ b/service/go.sum @@ -1,13 +1,15 @@ -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.34.1-20240508200655-46a4cf4ba109.1 h1:LEXWFH/xZ5oOWrC3oOtHbUyBdzRWMCPpAQmKC9v05mA= -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.34.1-20240508200655-46a4cf4ba109.1/go.mod h1:XF+P8+RmfdufmIYpGUC+6bF7S+IlmHDEnCrO3OXaUAQ= -connectrpc.com/connect v1.17.0 h1:W0ZqMhtVzn9Zhn2yATuUokDLO5N+gIuBWMOnsQrfmZk= -connectrpc.com/connect v1.17.0/go.mod h1:0292hj1rnx8oFrStN7cB4jjVBeqs+Yx5yDIC2prWDO8= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250307204501-0409229c3780.1 h1:zgJPqo17m28+Lf5BW4xv3PvU20BnrmTcGYrog22lLIU= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250307204501-0409229c3780.1/go.mod h1:avRlCjnFzl98VPaeCtJ24RrV/wwHFzB8sWXhj26+n/U= +cel.dev/expr v0.19.1 h1:NciYrtDRIR0lNCnH1LFJegdjspNx9fI59O7TWcua/W4= +cel.dev/expr v0.19.1/go.mod h1:MrpN08Q+lEBs+bGYdLxxHkZoUSsCp0nSKTs0nTymJgw= +connectrpc.com/connect v1.18.1 h1:PAg7CjSAGvscaf6YZKUefjoih5Z/qYkyaTrBW8xvYPw= +connectrpc.com/connect v1.18.1/go.mod h1:0292hj1rnx8oFrStN7cB4jjVBeqs+Yx5yDIC2prWDO8= connectrpc.com/grpchealth v1.3.0 h1:FA3OIwAvuMokQIXQrY5LbIy8IenftksTP/lG4PbYN+E= connectrpc.com/grpchealth v1.3.0/go.mod h1:3vpqmX25/ir0gVgW6RdnCPPZRcR6HvqtXX5RNPmDXHM= connectrpc.com/grpcreflect v1.2.0 h1:Q6og1S7HinmtbEuBvARLNwYmTbhEGRpHDhqrPNlmK+U= connectrpc.com/grpcreflect v1.2.0/go.mod h1:nwSOKmE8nU5u/CidgHtPYk1PFI3U9ignz7iDMxOYkSY= -connectrpc.com/validate v0.1.0 h1:r55jirxMK7HO/xZwVHj3w2XkVFarsUM77ZDy367NtH4= -connectrpc.com/validate v0.1.0/go.mod h1:GU47c9/x/gd+u9wRSPkrQOP46gx2rMN+Wo37EHgI3Ow= +connectrpc.com/validate v0.2.0 h1:izFAPJwZzfseE93aq0ZqnMBsuNRXKZe6aDWZ3vo8dhY= +connectrpc.com/validate v0.2.0/go.mod h1:3v6kC0nIp6DtXwDMdq/BXrVPPm+w3nWlHW8T193FErE= dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU= @@ -44,8 +46,8 @@ github.com/bmatcuk/doublestar v1.3.4 h1:gPypJ5xD31uhX6Tf54sDPUOBXTqKH4c9aPY66CyQ github.com/bmatcuk/doublestar v1.3.4/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE= github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I= github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= -github.com/bufbuild/protovalidate-go v0.6.0 h1:Jgs1kFuZ2LHvvdj8SpCLA1W/+pXS8QSM3F/E2l3InPY= -github.com/bufbuild/protovalidate-go v0.6.0/go.mod h1:1LamgoYHZ2NdIQH0XGczGTc6Z8YrTHjcJVmiBaar4t4= +github.com/bufbuild/protovalidate-go v0.9.3 h1:XvdtwQuppS3wjzGfpOirsqwN5ExH2+PiIuA/XZd3MTM= +github.com/bufbuild/protovalidate-go v0.9.3/go.mod h1:2lUDP6fNd3wxznRNH3Nj64VB07+PySeslamkerwP6tE= github.com/bytecodealliance/wasmtime-go/v3 v3.0.2 h1:3uZCA/BLTIu+DqCfguByNMJa2HVHpXvjfy0Dy7g6fuA= github.com/bytecodealliance/wasmtime-go/v3 v3.0.2/go.mod h1:RnUjnIXxEJcL6BgCvNyzCCRzZcxCgsZCi+RNlvYor5Q= github.com/casbin/casbin/v2 v2.101.0 h1:y8qZRXcgv5omd3k/7kpaP03Hov82sXzCC5FAfm17lkw= @@ -101,8 +103,8 @@ github.com/elastic/go-sysinfo v1.11.2 h1:mcm4OSYVMyws6+n2HIVMGkln5HOpo5Ie1ZmbbNn github.com/elastic/go-sysinfo v1.11.2/go.mod h1:GKqR8bbMK/1ITnez9NIsIfXQr25aLhRJa7AfT8HpBFQ= github.com/elastic/go-windows v1.0.1 h1:AlYZOldA+UJ0/2nBuqWdo90GFCgG9xuyw9SYzGUtJm0= github.com/elastic/go-windows v1.0.1/go.mod h1:FoVvqWSun28vaDQPbj2Elfc0JahhPB7WQEGa3c814Ss= -github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM= -github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4= +github.com/envoyproxy/protoc-gen-validate v1.2.1 h1:DEo3O99U8j4hBFwbJfrz9VtgcDfUKS7KJ7spH3d86P8= +github.com/envoyproxy/protoc-gen-validate v1.2.1/go.mod h1:d/C80l/jxXLdfEIhX1W2TmLfsJ31lvEjwamM4DxlWXU= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= @@ -159,16 +161,14 @@ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4er github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/cel-go v0.20.1 h1:nDx9r8S3L4pE61eDdt8igGj8rf5kjYR3ILxWIpWNi84= -github.com/google/cel-go v0.20.1/go.mod h1:kWcIzTsPX0zmQ+H3TirHstLLf9ep5QTsZBN9u4dOYLg= +github.com/google/cel-go v0.24.1 h1:jsBCtxG8mM5wiUJDSGUqU0K7Mtr3w7Eyv00rw4DiZxI= +github.com/google/cel-go v0.24.1/go.mod h1:Hdf9TqOaTNSFQA1ybQaRqATVoK7m/zcf7IMhGXP5zI8= github.com/google/flatbuffers v23.5.26+incompatible h1:M9dgRyhJemaM4Sw8+66GHBu8ioaQmyPLg1b8VwK5WJg= github.com/google/flatbuffers v23.5.26+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= @@ -364,8 +364,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/tchap/go-patricia/v2 v2.3.1 h1:6rQp39lgIYZ+MHmdEq4xzuk1t7OdC35z/xm0BGhTkes= @@ -431,8 +431,8 @@ golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDf golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs= golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ= -golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ= -golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= +golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 h1:aAcj0Da7eBAtrTp03QXWvm88pSyOt+UgdZw2BFZ+lEw= +golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8/go.mod h1:CQ1k9gNrJ50XIzaKCRR2hssIjF07kZFEiieALBM/ARQ= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -462,8 +462,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= -golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= +golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -499,8 +499,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= -golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= +golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= +golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= @@ -524,10 +524,8 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1: google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= -google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/service/internal/access/pdp_test.go b/service/internal/access/pdp_test.go index 93c571d843..10c55c53e5 100644 --- a/service/internal/access/pdp_test.go +++ b/service/internal/access/pdp_test.go @@ -1,7 +1,6 @@ package access import ( - ctx "context" "testing" "github.com/opentdf/platform/protocol/go/policy" @@ -111,7 +110,7 @@ func Test_AccessPDP_AnyOf_Pass(t *testing.T) { accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions, @@ -142,7 +141,7 @@ func Test_AccessPDP_AnyOf_FailMissingValue(t *testing.T) { accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions) @@ -172,7 +171,7 @@ func Test_AccessPDP_AnyOf_FailMissingAttr(t *testing.T) { accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions) @@ -201,7 +200,7 @@ func Test_AccessPDP_AnyOf_FailAttrWrongNamespace(t *testing.T) { accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions) @@ -228,7 +227,7 @@ func Test_AccessPDP_AnyOf_NoEntityAttributes_Fails(t *testing.T) { accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions) @@ -256,7 +255,7 @@ func Test_AccessPDP_AnyOf_NoDataAttributes_NoDecisions(t *testing.T) { accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions) @@ -304,7 +303,7 @@ func Test_AccessPDP_AnyOf_AllEntitiesFilteredOutOfDataAttributeComparison_NoDeci accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions) @@ -339,7 +338,7 @@ func Test_AccessPDP_AllOf_Pass(t *testing.T) { accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions) @@ -367,7 +366,7 @@ func Test_AccessPDP_AllOf_FailMissingValue(t *testing.T) { accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions) @@ -396,7 +395,7 @@ func Test_AccessPDP_AllOf_FailMissingAttr(t *testing.T) { } accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions) @@ -428,7 +427,7 @@ func Test_AccessPDP_AllOf_FailAttrWrongNamespace(t *testing.T) { accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions) @@ -462,7 +461,7 @@ func Test_AccessPDP_Hierarchy_Pass(t *testing.T) { accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions) @@ -496,7 +495,7 @@ func Test_AccessPDP_Hierarchy_FailEntityValueTooLow(t *testing.T) { accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions) @@ -524,7 +523,7 @@ func Test_AccessPDP_Hierarchy_FailEntityValueAndDataValuesBothLowest(t *testing. accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions) @@ -557,7 +556,7 @@ func Test_AccessPDP_Hierarchy_FailEntityValueOrder(t *testing.T) { accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions) @@ -590,7 +589,7 @@ func Test_AccessPDP_Hierarchy_FailMultipleHierarchyDataValues(t *testing.T) { accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions) @@ -621,7 +620,7 @@ func Test_AccessPDP_Hierarchy_FailEntityValueNotInOrder(t *testing.T) { accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions) @@ -653,7 +652,7 @@ func Test_AccessPDP_Hierarchy_FailDataValueNotInOrder(t *testing.T) { accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions) @@ -688,7 +687,7 @@ func Test_AccessPDP_Hierarchy_PassWithMixedKnownAndUnknownDataOrder(t *testing.T accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions) @@ -715,7 +714,7 @@ func Test_AccessPDP_Hierarchy_FailWithWrongNamespace(t *testing.T) { accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions) @@ -748,7 +747,7 @@ func Test_AccessPDP_Hierarchy_FailWithMixedKnownAndUnknownEntityOrder(t *testing accessPDP := NewPdp(logger.CreateTestLogger()) decisions, err := accessPDP.DetermineAccess( - ctx.Background(), + t.Context(), mockDataAttrs, mockEntityAttrs, mockAttrDefinitions) @@ -771,7 +770,7 @@ func Test_GetFqnToDefinitionMap(t *testing.T) { &simpleHierarchyAttribute, } - fqnToDefinitionMap, err := GetFqnToDefinitionMap(ctx.Background(), mockAttrDefinitions, logger.CreateTestLogger()) + fqnToDefinitionMap, err := GetFqnToDefinitionMap(t.Context(), mockAttrDefinitions, logger.CreateTestLogger()) require.NoError(t, err) for _, attrDef := range mockAttrDefinitions { @@ -786,7 +785,7 @@ func Test_GetFqnToDefinitionMap_SucceedsWithDuplicateDefinitions(t *testing.T) { &simpleAnyOfAttribute, } - fqnToDefinitionMap, err := GetFqnToDefinitionMap(ctx.Background(), mockAttrDefinitions, logger.CreateTestLogger()) + fqnToDefinitionMap, err := GetFqnToDefinitionMap(t.Context(), mockAttrDefinitions, logger.CreateTestLogger()) require.NoError(t, err) expectedFqn := fqnBuilder(mockAttrDefinitions[0].GetNamespace().GetName(), mockAttrDefinitions[0].GetName(), "") v, ok := fqnToDefinitionMap[expectedFqn] diff --git a/service/kas/access/publicKey_test.go b/service/kas/access/publicKey_test.go index 047d6028b4..adbe0b905e 100644 --- a/service/kas/access/publicKey_test.go +++ b/service/kas/access/publicKey_test.go @@ -1,7 +1,6 @@ package access import ( - "context" "crypto/ecdsa" "crypto/elliptic" "crypto/rand" @@ -100,7 +99,7 @@ func TestStandardCertificateHandlerEmpty(t *testing.T) { Logger: logger.CreateTestLogger(), } - result, err := kas.PublicKey(context.Background(), &connect.Request[kaspb.PublicKeyRequest]{Msg: &kaspb.PublicKeyRequest{Fmt: "pkcs8"}}) + result, err := kas.PublicKey(t.Context(), &connect.Request[kaspb.PublicKeyRequest]{Msg: &kaspb.PublicKeyRequest{Fmt: "pkcs8"}}) require.Error(t, err, "not found") assert.Nil(t, result) } @@ -156,13 +155,13 @@ func TestStandardPublicKeyHandlerV2(t *testing.T) { }, } - result, err := kas.PublicKey(context.Background(), &connect.Request[kaspb.PublicKeyRequest]{Msg: &kaspb.PublicKeyRequest{}}) + result, err := kas.PublicKey(t.Context(), &connect.Request[kaspb.PublicKeyRequest]{Msg: &kaspb.PublicKeyRequest{}}) require.NoError(t, err) require.NotNil(t, result) assert.Contains(t, result.Msg.GetPublicKey(), "BEGIN PUBLIC KEY") assert.Equal(t, "rsa", result.Msg.GetKid()) - result, err = kas.PublicKey(context.Background(), &connect.Request[kaspb.PublicKeyRequest]{Msg: &kaspb.PublicKeyRequest{ + result, err = kas.PublicKey(t.Context(), &connect.Request[kaspb.PublicKeyRequest]{Msg: &kaspb.PublicKeyRequest{ Algorithm: "ec:secp256r1", }}) require.NoError(t, err) @@ -184,7 +183,7 @@ func TestStandardPublicKeyHandlerV2Failure(t *testing.T) { Logger: logger.CreateTestLogger(), } - k, err := kas.PublicKey(context.Background(), &connect.Request[kaspb.PublicKeyRequest]{Msg: &kaspb.PublicKeyRequest{}}) + k, err := kas.PublicKey(t.Context(), &connect.Request[kaspb.PublicKeyRequest]{Msg: &kaspb.PublicKeyRequest{}}) assert.Nil(t, k) require.Error(t, err) } @@ -210,7 +209,7 @@ func TestStandardPublicKeyHandlerV2NotFound(t *testing.T) { Logger: logger.CreateTestLogger(), } - k, err := kas.PublicKey(context.Background(), &connect.Request[kaspb.PublicKeyRequest]{ + k, err := kas.PublicKey(t.Context(), &connect.Request[kaspb.PublicKeyRequest]{ Msg: &kaspb.PublicKeyRequest{ Algorithm: "algorithm:unknown", }, @@ -251,7 +250,7 @@ func TestStandardPublicKeyHandlerV2WithJwk(t *testing.T) { Logger: logger.CreateTestLogger(), } - result, err := kas.PublicKey(context.Background(), &connect.Request[kaspb.PublicKeyRequest]{ + result, err := kas.PublicKey(t.Context(), &connect.Request[kaspb.PublicKeyRequest]{ Msg: &kaspb.PublicKeyRequest{ Algorithm: "rsa:2048", V: "2", @@ -287,7 +286,7 @@ func TestStandardCertificateHandlerWithEc256(t *testing.T) { Logger: logger.CreateTestLogger(), } - result, err := kas.LegacyPublicKey(context.Background(), &connect.Request[kaspb.LegacyPublicKeyRequest]{ + result, err := kas.LegacyPublicKey(t.Context(), &connect.Request[kaspb.LegacyPublicKeyRequest]{ Msg: &kaspb.LegacyPublicKeyRequest{ Algorithm: "ec:secp256r1", }, @@ -321,7 +320,7 @@ func TestStandardPublicKeyHandlerWithEc256(t *testing.T) { Logger: logger.CreateTestLogger(), } - result, err := kas.PublicKey(context.Background(), &connect.Request[kaspb.PublicKeyRequest]{ + result, err := kas.PublicKey(t.Context(), &connect.Request[kaspb.PublicKeyRequest]{ Msg: &kaspb.PublicKeyRequest{ Algorithm: "ec:secp256r1", }, @@ -355,7 +354,7 @@ func TestStandardPublicKeyHandlerV2WithEc256(t *testing.T) { Logger: logger.CreateTestLogger(), } - result, err := kas.PublicKey(context.Background(), &connect.Request[kaspb.PublicKeyRequest]{ + result, err := kas.PublicKey(t.Context(), &connect.Request[kaspb.PublicKeyRequest]{ Msg: &kaspb.PublicKeyRequest{ Algorithm: "ec:secp256r1", V: "2", diff --git a/service/kas/access/rewrap_test.go b/service/kas/access/rewrap_test.go index 14ad8b6207..2cde2952b1 100644 --- a/service/kas/access/rewrap_test.go +++ b/service/kas/access/rewrap_test.go @@ -209,7 +209,7 @@ func keyAccessWrappedRaw(t *testing.T, policyBindingAsString bool) kaspb.Unsigne require.NoError(t, err, "rewrap: encryptWithPublicKey failed") logger := logger.CreateTestLogger() - bindingBytes, err := generateHMACDigest(context.Background(), policyBytes, []byte(plainKey), *logger) + bindingBytes, err := generateHMACDigest(t.Context(), policyBytes, []byte(plainKey), *logger) require.NoError(t, err) dst := make([]byte, hex.EncodedLen(len(bindingBytes))) @@ -335,7 +335,7 @@ func TestParseAndVerifyRequest(t *testing.T) { // The execution loop for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - ctx := context.Background() + ctx := t.Context() bearer := string(jwtStandard(t)) if tt.addDPoP { var key jwk.Key @@ -370,7 +370,7 @@ func TestParseAndVerifyRequest(t *testing.T) { require.NotNil(t, verified.GetClientPublicKey(), "unable to load public key") for _, req := range verified.GetRequests() { - err := verifyPolicyBinding(context.Background(), []byte(req.GetPolicy().GetBody()), req.GetKeyAccessObjects()[0], []byte(plainKey), *logger) + err := verifyPolicyBinding(t.Context(), []byte(req.GetPolicy().GetBody()), req.GetKeyAccessObjects()[0], []byte(plainKey), *logger) if !tt.shouldError { require.NoError(t, err, "failed to verify policy body=[%v]", tt.body) } else { @@ -385,7 +385,7 @@ func TestParseAndVerifyRequest(t *testing.T) { } func Test_SignedRequestBody_When_Bad_Signature_Expect_Failure(t *testing.T) { - ctx := context.Background() + ctx := t.Context() key, err := jwk.FromRaw([]byte("bad key")) require.NoError(t, err, "couldn't get JWK from key") @@ -409,14 +409,14 @@ func Test_SignedRequestBody_When_Bad_Signature_Expect_Failure(t *testing.T) { } func Test_GetEntityInfo_When_Missing_MD_Expect_Error(t *testing.T) { - ctx := context.Background() + ctx := t.Context() _, err := getEntityInfo(ctx, logger.CreateTestLogger()) require.Error(t, err) require.Contains(t, err.Error(), "missing") } func Test_GetEntityInfo_When_Authorization_MD_Missing_Expect_Error(t *testing.T) { - ctx := context.Background() + ctx := t.Context() ctx = metadata.NewIncomingContext(ctx, metadata.New(map[string]string{"token": "test"})) _, err := getEntityInfo(ctx, logger.CreateTestLogger()) @@ -425,7 +425,7 @@ func Test_GetEntityInfo_When_Authorization_MD_Missing_Expect_Error(t *testing.T) } func Test_GetEntityInfo_When_Authorization_MD_Invalid_Expect_Error(t *testing.T) { - ctx := context.Background() + ctx := t.Context() ctx = metadata.NewIncomingContext(ctx, metadata.New(map[string]string{"authorization": "pop test"})) _, err := getEntityInfo(ctx, logger.CreateTestLogger()) diff --git a/service/logger/audit/utils_test.go b/service/logger/audit/utils_test.go index b87d311472..51da797423 100644 --- a/service/logger/audit/utils_test.go +++ b/service/logger/audit/utils_test.go @@ -13,7 +13,7 @@ import ( ) func TestGetAuditDataFromContextHappyPath(t *testing.T) { - ctx := context.Background() + ctx := t.Context() testRequestID := uuid.New() testUserAgent := "test-user-agent" testRequestIP := net.ParseIP("192.168.0.1") @@ -47,7 +47,7 @@ func TestGetAuditDataFromContextHappyPath(t *testing.T) { } func TestGetAuditDataFromContextDefaultsPath(t *testing.T) { - ctx := context.Background() + ctx := t.Context() auditData := GetAuditDataFromContext(ctx) @@ -69,7 +69,7 @@ func TestGetAuditDataFromContextDefaultsPath(t *testing.T) { } func TestGetAuditDataFromContextWithNoKeys(t *testing.T) { - ctx := context.Background() + ctx := t.Context() auditData := GetAuditDataFromContext(ctx) if auditData.RequestID != uuid.Nil { @@ -90,7 +90,7 @@ func TestGetAuditDataFromContextWithNoKeys(t *testing.T) { } func TestGetAuditDataFromContextWithPartialKeys(t *testing.T) { - ctx := context.Background() + ctx := t.Context() testUserAgent := "partial-user-agent" testActorID := "partial-actor-id" @@ -118,7 +118,7 @@ func TestGetAuditDataFromContextWithPartialKeys(t *testing.T) { } func TestGetAuditDataFromContextWrongType(t *testing.T) { - ctx := context.Background() + ctx := t.Context() testActorID := 12345 // Set relevant context keys diff --git a/service/pkg/auth/context_auth_test.go b/service/pkg/auth/context_auth_test.go index eedb5b540f..c015fe8270 100644 --- a/service/pkg/auth/context_auth_test.go +++ b/service/pkg/auth/context_auth_test.go @@ -17,7 +17,7 @@ func TestContextWithAuthNInfo(t *testing.T) { rawToken := "mockRawToken" // Initialize context - ctx := context.Background() + ctx := t.Context() newCtx := ContextWithAuthNInfo(ctx, mockJWK, mockJWT, rawToken) // Assert that the context contains the correct values @@ -33,7 +33,7 @@ func TestContextWithAuthNInfo(t *testing.T) { func TestGetJWKFromContext(t *testing.T) { // Create mock context with JWK mockJWK, _ := jwk.FromRaw([]byte("mockKey")) - ctx := ContextWithAuthNInfo(context.Background(), mockJWK, nil, "") + ctx := ContextWithAuthNInfo(t.Context(), mockJWK, nil, "") // Retrieve the JWK and assert retrievedJWK := GetJWKFromContext(ctx, logger.CreateTestLogger()) @@ -44,7 +44,7 @@ func TestGetJWKFromContext(t *testing.T) { func TestGetAccessTokenFromContext(t *testing.T) { // Create mock context with JWT mockJWT, _ := jwt.NewBuilder().Build() - ctx := ContextWithAuthNInfo(context.Background(), nil, mockJWT, "") + ctx := ContextWithAuthNInfo(t.Context(), nil, mockJWT, "") // Retrieve the JWT and assert retrievedJWT := GetAccessTokenFromContext(ctx, logger.CreateTestLogger()) @@ -55,7 +55,7 @@ func TestGetAccessTokenFromContext(t *testing.T) { func TestGetRawAccessTokenFromContext(t *testing.T) { // Create mock context with raw token rawToken := "mockRawToken" - ctx := ContextWithAuthNInfo(context.Background(), nil, nil, rawToken) + ctx := ContextWithAuthNInfo(t.Context(), nil, nil, rawToken) // Retrieve the raw token and assert retrievedRawToken := GetRawAccessTokenFromContext(ctx, logger.CreateTestLogger()) @@ -64,7 +64,7 @@ func TestGetRawAccessTokenFromContext(t *testing.T) { func TestGetContextDetailsInvalidType(t *testing.T) { // Create a context with an invalid type - ctx := context.WithValue(context.Background(), authnContextKey, "invalidType") + ctx := context.WithValue(t.Context(), authnContextKey, "invalidType") // Assert that GetJWKFromContext handles the invalid type correctly retrievedJWK := GetJWKFromContext(ctx, logger.CreateTestLogger()) diff --git a/service/pkg/config/config_test.go b/service/pkg/config/config_test.go index 568c8e4bb7..e5328c5135 100644 --- a/service/pkg/config/config_test.go +++ b/service/pkg/config/config_test.go @@ -92,7 +92,7 @@ func TestConfig_AddOnConfigChangeHook(t *testing.T) { } func TestConfig_Watch(t *testing.T) { - ctx := context.Background() + ctx := t.Context() t.Run("No loaders", func(t *testing.T) { config := &Config{} @@ -134,7 +134,7 @@ func TestConfig_Watch(t *testing.T) { } func TestConfig_Close(t *testing.T) { - ctx := context.Background() + ctx := t.Context() t.Run("No loaders", func(t *testing.T) { config := &Config{} @@ -170,7 +170,7 @@ func TestConfig_Close(t *testing.T) { } func TestConfig_OnChange(t *testing.T) { - ctx := context.Background() + ctx := t.Context() t.Run("No hooks", func(t *testing.T) { config := &Config{} @@ -213,7 +213,7 @@ func TestConfig_OnChange(t *testing.T) { } func TestLoadConfig_NoFileExistsInEnv(t *testing.T) { - ctx := context.Background() + ctx := t.Context() _, err := LoadConfig(ctx, "test", "non-existent-file") assert.Error(t, err) } @@ -251,7 +251,7 @@ server: tempFile.Close() // Call LoadConfig with the temp file - ctx := context.Background() + ctx := t.Context() config, err := LoadConfig(ctx, "test", tempFile.Name()) // Assertions diff --git a/service/policy/attributes/attributes_test.go b/service/policy/attributes/attributes_test.go index 075678bcaf..7cdae74df1 100644 --- a/service/policy/attributes/attributes_test.go +++ b/service/policy/attributes/attributes_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/require" ) -func getValidator() *protovalidate.Validator { +func getValidator() protovalidate.Validator { v, err := protovalidate.New() if err != nil { panic(err) diff --git a/service/policy/kasregistry/key_access_server_registry_test.go b/service/policy/kasregistry/key_access_server_registry_test.go index 602cfb9abc..167744ee18 100644 --- a/service/policy/kasregistry/key_access_server_registry_test.go +++ b/service/policy/kasregistry/key_access_server_registry_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/require" ) -func getValidator() *protovalidate.Validator { +func getValidator() protovalidate.Validator { v, err := protovalidate.New() if err != nil { panic(err) diff --git a/service/policy/namespaces/namespaces_test.go b/service/policy/namespaces/namespaces_test.go index adce58a5ea..8ac16d3e18 100644 --- a/service/policy/namespaces/namespaces_test.go +++ b/service/policy/namespaces/namespaces_test.go @@ -19,7 +19,7 @@ const ( errExclusiveFields = "exclusive_fields" ) -func getValidator() *protovalidate.Validator { +func getValidator() protovalidate.Validator { v, err := protovalidate.New() if err != nil { panic(err) diff --git a/service/policy/resourcemapping/resource_mapping_test.go b/service/policy/resourcemapping/resource_mapping_test.go index 81efcd3b88..a2fba3bd2b 100644 --- a/service/policy/resourcemapping/resource_mapping_test.go +++ b/service/policy/resourcemapping/resource_mapping_test.go @@ -48,7 +48,7 @@ var ( } ) -func getValidator() *protovalidate.Validator { +func getValidator() protovalidate.Validator { v, err := protovalidate.New() if err != nil { panic(err) diff --git a/service/policy/subjectmapping/subject_mapping_test.go b/service/policy/subjectmapping/subject_mapping_test.go index 659b069710..b9dede79bf 100644 --- a/service/policy/subjectmapping/subject_mapping_test.go +++ b/service/policy/subjectmapping/subject_mapping_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" ) -func getValidator() *protovalidate.Validator { +func getValidator() protovalidate.Validator { v, err := protovalidate.New() if err != nil { panic(err) diff --git a/service/policy/unsafe/unsafe_test.go b/service/policy/unsafe/unsafe_test.go index 8e7d59bcbe..b5f0459aa7 100644 --- a/service/policy/unsafe/unsafe_test.go +++ b/service/policy/unsafe/unsafe_test.go @@ -13,7 +13,7 @@ var ( validUUID = "00000000-0000-0000-0000-000000000000" ) -func getValidator() *protovalidate.Validator { +func getValidator() protovalidate.Validator { v, err := protovalidate.New() if err != nil { panic(err)