diff --git a/clients/go/go.mod b/clients/go/go.mod index 026b47f77..333f2c7a1 100644 --- a/clients/go/go.mod +++ b/clients/go/go.mod @@ -34,9 +34,9 @@ require ( cloud.google.com/go/compute v1.6.1 github.com/GoogleCloudPlatform/opentelemetry-operations-go v1.0.0 github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.0.0 - github.com/abcxyz/jvs v0.0.0-20220713181819-5cc3eb83dc6b - github.com/abcxyz/jvs/client-lib/go v0.0.0-20220713181819-5cc3eb83dc6b - github.com/abcxyz/pkg v0.0.0-20220627210229-493bf5fec862 + github.com/abcxyz/jvs v0.0.2-0.20220915004312-db26d444b9ae + github.com/abcxyz/jvs/client-lib/go v0.0.0-20220915004312-db26d444b9ae + github.com/abcxyz/pkg v0.0.0-20220719233420-62c7b76c10e9 github.com/golang-jwt/jwt v3.2.2+incompatible github.com/google/uuid v1.3.0 github.com/lestrrat-go/jwx/v2 v2.0.3 diff --git a/clients/go/go.sum b/clients/go/go.sum index f407c4e6c..bf761ef89 100644 --- a/clients/go/go.sum +++ b/clients/go/go.sum @@ -72,12 +72,12 @@ github.com/GoogleCloudPlatform/opentelemetry-operations-go v1.0.0/go.mod h1:geb4 github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.0.0 h1:38fNtfhHY6bs22b/D6+hDzO6JR0rDzpGPD36dY2uPL4= github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.0.0/go.mod h1:jE23wM1jvwSKgdGcoOkj5j9n1VWtncW36pL2bK1JU+0= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/abcxyz/jvs v0.0.0-20220713181819-5cc3eb83dc6b h1:uhx0EiUkwUoy/1Hem9pwZpSI0cZuJ9BVlqjTvOYDAPg= -github.com/abcxyz/jvs v0.0.0-20220713181819-5cc3eb83dc6b/go.mod h1:6XWVLVHrfIBFXN76Fh072E8nd0RSmSyYr9MKArSRAr8= -github.com/abcxyz/jvs/client-lib/go v0.0.0-20220713181819-5cc3eb83dc6b h1:CSIaB0wokXj9Jg/WWi5yGjD7dZh+U+0lmhcwE9HDpT0= -github.com/abcxyz/jvs/client-lib/go v0.0.0-20220713181819-5cc3eb83dc6b/go.mod h1:NfOLJjKgctTBVl2JdDON861Ei6JGLSP6itlUn28Odc4= -github.com/abcxyz/pkg v0.0.0-20220627210229-493bf5fec862 h1:DEU4U/AgVWsxWhrO9rBUytuuXL6tznVPDxx2q2DI6c0= -github.com/abcxyz/pkg v0.0.0-20220627210229-493bf5fec862/go.mod h1:Sz/e+0vW0XIIeeIS4KDLIeh1Bb/CPAvQiZOdOTBiW4k= +github.com/abcxyz/jvs v0.0.2-0.20220915004312-db26d444b9ae h1:M3yMSghNGXElhcEOJBxqlO8QQRs3cVmM5ncDl69C00I= +github.com/abcxyz/jvs v0.0.2-0.20220915004312-db26d444b9ae/go.mod h1:m9PZgVFkkLDtncjzrcwXbvBhMwpOCvggWqsAwMxNtQg= +github.com/abcxyz/jvs/client-lib/go v0.0.0-20220915004312-db26d444b9ae h1:kFhazhdgrLp52yDe4p3nLjGjeELbb/9YhjlckEAN6e4= +github.com/abcxyz/jvs/client-lib/go v0.0.0-20220915004312-db26d444b9ae/go.mod h1:MEmok7HO/fVqapbrQIBulDK805eHE0ZXvHgRCPFRV6s= +github.com/abcxyz/pkg v0.0.0-20220719233420-62c7b76c10e9 h1:ROwNYAzdaFBjS9dTzmTjwgW84QaKQWxUFm3zlSbP77I= +github.com/abcxyz/pkg v0.0.0-20220719233420-62c7b76c10e9/go.mod h1:Sz/e+0vW0XIIeeIS4KDLIeh1Bb/CPAvQiZOdOTBiW4k= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -97,8 +97,6 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/clients/go/pkg/audit/interceptor_test.go b/clients/go/pkg/audit/interceptor_test.go index 3afcf4c29..acf23a97c 100644 --- a/clients/go/pkg/audit/interceptor_test.go +++ b/clients/go/pkg/audit/interceptor_test.go @@ -77,7 +77,7 @@ type fakeJVS struct { returnErr bool } -func (j *fakeJVS) ValidateJWT(_ string) (*jwt.Token, error) { +func (j *fakeJVS) ValidateJWT(_ string) (jwt.Token, error) { if j.returnErr { return nil, fmt.Errorf("validate jwt error") } @@ -91,7 +91,7 @@ func (j *fakeJVS) ValidateJWT(_ string) (*jwt.Token, error) { if err := t.Set(jwt.JwtIDKey, "123"); err != nil { return nil, err } - return &t, nil + return t, nil } func TestUnaryInterceptor(t *testing.T) { diff --git a/clients/go/pkg/auditopt/config.go b/clients/go/pkg/auditopt/config.go index 6f80ab84f..f47cc48e3 100644 --- a/clients/go/pkg/auditopt/config.go +++ b/clients/go/pkg/auditopt/config.go @@ -263,7 +263,7 @@ func justificationFromConfig(ctx context.Context, cfg *api.Config) (audit.Option // TODO(#299): allow overriding these values via JVS env var. jvsconfig := &client.JVSConfig{ JVSEndpoint: cfg.Justification.PublicKeysEndpoint, - Version: 1, + Version: "1", CacheTimeout: 5 * time.Minute, } jvsClient, err := client.NewJVSClient(ctx, jvsconfig) diff --git a/clients/go/pkg/justification/processor.go b/clients/go/pkg/justification/processor.go index 5a6d25cf7..22357063b 100644 --- a/clients/go/pkg/justification/processor.go +++ b/clients/go/pkg/justification/processor.go @@ -39,7 +39,7 @@ const ( // Validator validates justification token generated by JVS. type Validator interface { // ValidateJWT validates justification token generated by JVS. - ValidateJWT(jvsToken string) (*jwt.Token, error) + ValidateJWT(jvsToken string) (jwt.Token, error) } // Processor populates an audit log request with justification. @@ -71,7 +71,7 @@ func (p *Processor) Process(ctx context.Context, logReq *api.AuditLogRequest) er return fmt.Errorf("failed to validate justification token: %w", err) } - b, err := json.Marshal(*tok) + b, err := json.Marshal(tok) if err != nil { return fmt.Errorf("failed to encode justification token: %w", err) } @@ -93,7 +93,7 @@ func (p *Processor) Process(ctx context.Context, logReq *api.AuditLogRequest) er logReq.Payload.Metadata.Fields[LogMetadataKey] = structpb.NewStructValue(&tokStruct) - justs, ok := (*tok).Get("justs") + justs, ok := tok.Get("justs") if !ok { logger.Warn("can't find 'justs' in claims") } else { diff --git a/clients/go/pkg/justification/processor_test.go b/clients/go/pkg/justification/processor_test.go index 0bb1d8fe4..0031c0995 100644 --- a/clients/go/pkg/justification/processor_test.go +++ b/clients/go/pkg/justification/processor_test.go @@ -138,7 +138,7 @@ type fakeValidator struct { justifications []*jvsapi.Justification } -func (v *fakeValidator) ValidateJWT(jvsToken string) (*jwt.Token, error) { +func (v *fakeValidator) ValidateJWT(jvsToken string) (jwt.Token, error) { if v.returnErr { return nil, fmt.Errorf("failed to validate JWT") } @@ -159,5 +159,5 @@ func (v *fakeValidator) ValidateJWT(jvsToken string) (*jwt.Token, error) { if err := tok.Set("justs", v.justifications); err != nil { return nil, err } - return &tok, nil + return tok, nil } diff --git a/go.mod b/go.mod index 2eb6fb825..01177c207 100644 --- a/go.mod +++ b/go.mod @@ -6,9 +6,9 @@ require ( cloud.google.com/go/bigquery v1.32.0 cloud.google.com/go/compute v1.6.1 cloud.google.com/go/logging v1.4.2 - github.com/abcxyz/jvs v0.0.1 + github.com/abcxyz/jvs v0.0.2-0.20220915004312-db26d444b9ae github.com/abcxyz/lumberjack/clients/go v0.0.0-00010101000000-000000000000 - github.com/abcxyz/pkg v0.0.0-20220627210229-493bf5fec862 + github.com/abcxyz/pkg v0.0.0-20220719233420-62c7b76c10e9 github.com/golang-jwt/jwt v3.2.2+incompatible github.com/google/go-cmp v0.5.8 github.com/google/uuid v1.3.0 diff --git a/go.sum b/go.sum index a038fa3da..3792af8b0 100644 --- a/go.sum +++ b/go.sum @@ -78,10 +78,10 @@ github.com/GoogleCloudPlatform/opentelemetry-operations-go v1.0.0/go.mod h1:geb4 github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.0.0 h1:38fNtfhHY6bs22b/D6+hDzO6JR0rDzpGPD36dY2uPL4= github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.0.0/go.mod h1:jE23wM1jvwSKgdGcoOkj5j9n1VWtncW36pL2bK1JU+0= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/abcxyz/jvs v0.0.1 h1:hgX0lRUE/00skxnJet34DfhCVQHd8Abkv1iiVrV4c2s= -github.com/abcxyz/jvs v0.0.1/go.mod h1:rNyEfHM1lxOKHzrDGGqzvneJ5r3Bl/9W52rog8pQbs8= -github.com/abcxyz/pkg v0.0.0-20220627210229-493bf5fec862 h1:DEU4U/AgVWsxWhrO9rBUytuuXL6tznVPDxx2q2DI6c0= -github.com/abcxyz/pkg v0.0.0-20220627210229-493bf5fec862/go.mod h1:Sz/e+0vW0XIIeeIS4KDLIeh1Bb/CPAvQiZOdOTBiW4k= +github.com/abcxyz/jvs v0.0.2-0.20220915004312-db26d444b9ae h1:M3yMSghNGXElhcEOJBxqlO8QQRs3cVmM5ncDl69C00I= +github.com/abcxyz/jvs v0.0.2-0.20220915004312-db26d444b9ae/go.mod h1:m9PZgVFkkLDtncjzrcwXbvBhMwpOCvggWqsAwMxNtQg= +github.com/abcxyz/pkg v0.0.0-20220719233420-62c7b76c10e9 h1:ROwNYAzdaFBjS9dTzmTjwgW84QaKQWxUFm3zlSbP77I= +github.com/abcxyz/pkg v0.0.0-20220719233420-62c7b76c10e9/go.mod h1:Sz/e+0vW0XIIeeIS4KDLIeh1Bb/CPAvQiZOdOTBiW4k= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=