diff --git a/auth/keys_test.go b/auth/keys_test.go index c4a42e483..8f301a666 100644 --- a/auth/keys_test.go +++ b/auth/keys_test.go @@ -27,7 +27,7 @@ func TestResuseKeySource(t *testing.T) { nextKeys := PublicKeySet{ Expiry: testTime.Add(2 * time.Second), Keys: map[string]*rsa.PublicKey{ - "8289d54280b76712de41cd2ef95972b123be9ac0": &rsa.PublicKey{N: testGoogle2, E: 65537}, + "8289d54280b76712de41cd2ef95972b123be9ac0": &rsa.PublicKey{N: testGoogle(testGoogleKey2), E: 65537}, }, } @@ -104,8 +104,8 @@ func TestKeySetFromURL(t *testing.T) { wantKeys: PublicKeySet{ Expiry: testTime.Add(1 * time.Second), Keys: map[string]*rsa.PublicKey{ - "728f4016652079b9ed99861bb09bafc5a45baa86": &rsa.PublicKey{N: testGoogle1, E: 65537}, - "8289d54280b76712de41cd2ef95972b123be9ac0": &rsa.PublicKey{N: testGoogle2, E: 65537}, + "728f4016652079b9ed99861bb09bafc5a45baa86": {N: testGoogle(testGoogleKey1), E: 65537}, + "8289d54280b76712de41cd2ef95972b123be9ac0": {N: testGoogle(testGoogleKey2), E: 65537}, }, }, }, @@ -117,8 +117,8 @@ func TestKeySetFromURL(t *testing.T) { wantKeys: PublicKeySet{ Expiry: testTime.Add(5 * time.Second), Keys: map[string]*rsa.PublicKey{ - "728f4016652079b9ed99861bb09bafc5a45baa86": &rsa.PublicKey{N: testGoogle1, E: 65537}, - "8289d54280b76712de41cd2ef95972b123be9ac0": &rsa.PublicKey{N: testGoogle2, E: 65537}, + "728f4016652079b9ed99861bb09bafc5a45baa86": {N: testGoogle(testGoogleKey1), E: 65537}, + "8289d54280b76712de41cd2ef95972b123be9ac0": {N: testGoogle(testGoogleKey2), E: 65537}, }, }, }, @@ -145,8 +145,8 @@ func TestKeySetFromURL(t *testing.T) { wantKeys: PublicKeySet{ Expiry: testTime.Add(5 * time.Second), Keys: map[string]*rsa.PublicKey{ - "728f4016652079b9ed99861bb09bafc5a45baa86": &rsa.PublicKey{N: testGoogle1, E: 65537}, - "8289d54280b76712de41cd2ef95972b123be9ac0": &rsa.PublicKey{N: testGoogle2, E: 65537}, + "728f4016652079b9ed99861bb09bafc5a45baa86": {N: testGoogle(testGoogleKey1), E: 65537}, + "8289d54280b76712de41cd2ef95972b123be9ac0": {N: testGoogle(testGoogleKey2), E: 65537}, }, }, }, @@ -181,20 +181,18 @@ func TestKeySetFromURL(t *testing.T) { } var ( - testGoogleKey1 = "18112684417237113466774220553948287658642275536612278117358654328223325254239855900914880208928002193971790755769647369251185307648390933383803629253833792935549104394492595490970480288704258432536877269087694080352968836583401030682357884420432445619092471675752640354212779048186101852385524325549753366939320751885000360016238872619721767196169731422128756698973826778639560486979276112061913581353475855995717107174242233057925781337843224898645582603363390951368105740797845693907662079988391116580563176804122832211438500322243675724500523751141979116987975024595515232643410130766424608026731615327022863391377" - testGoogleKey2 = "22433090823316839640339489484457787676134304275873755218133861343920545237994470293495919014803004482856016084553850209153845425382613518932089311310596313310600424737736088033780907099977873221447195709312051528384355479077579673777886481089832045696620374920724411025483234264634539593436130076854768802102666090698524255278976644754677212286402099970599598264338136458077064875129043902522602870213617296706363155049264877048351659848686562003749244021217935734825983116131356048732262346697829165992404416525006735905763408678841171079087251498194471555953631250995421460080193870950448459655537601409828979901677" - testGoogle1 = func() *big.Int { - b := big.NewInt(0) - b.SetBytes([]byte(testGoogleKey1)) - return b - }() - testGoogle2 = func() *big.Int { - b := big.NewInt(0) - b.SetBytes([]byte(testGoogleKey2)) - return b - }() + testGoogleKey1 = "22433090823316839640339489484457787676134304275873755218133861343920545237994470293495919014803004482856016084553850209153845425382613518932089311310596313310600424737736088033780907099977873221447195709312051528384355479077579673777886481089832045696620374920724411025483234264634539593436130076854768802102666090698524255278976644754677212286402099970599598264338136458077064875129043902522602870213617296706363155049264877048351659848686562003749244021217935734825983116131356048732262346697829165992404416525006735905763408678841171079087251498194471555953631250995421460080193870950448459655537601409828979901677" + testGoogleKey2 = "18112684417237113466774220553948287658642275536612278117358654328223325254239855900914880208928002193971790755769647369251185307648390933383803629253833792935549104394492595490970480288704258432536877269087694080352968836583401030682357884420432445619092471675752640354212779048186101852385524325549753366939320751885000360016238872619721767196169731422128756698973826778639560486979276112061913581353475855995717107174242233057925781337843224898645582603363390951368105740797845693907662079988391116580563176804122832211438500322243675724500523751141979116987975024595515232643410130766424608026731615327022863391377" ) +func testGoogle(testKey string) *big.Int { + i, ok := new(big.Int).SetString(testKey, 10) + if !ok { + panic("bad number: " + testKey) + } + return i +} + const testGoogleCerts = `{ "keys": [ { diff --git a/go.sum b/go.sum index 4c49722a0..296e3a712 100644 --- a/go.sum +++ b/go.sum @@ -178,6 +178,7 @@ github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3 h1:SRgJV+IoxM5MKyFdlSUeNy6/ycRUF2yBAKdAQswoHUk= github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d h1:iaAPcMIY2f+gpk8tKf0BMW5sLrlhaASiYAnFmvVG5e0= github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/googleapis/gax-go/v2 v2.0.4 h1:hU4mGcQI4DaAYW+IbTun+2qEZVFxK0ySjQLTbS0VQKc= @@ -402,6 +403,7 @@ golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200331124033-c3d80250170d h1:nc5K6ox/4lTFbMVSL9WRR81ixkcwXThoiF6yf+R9scA= golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e h1:hq86ru83GdWTlfQFZGO4nZJTU4Bs2wfHl8oFHRaXsfc= golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -515,6 +517,7 @@ google.golang.org/genproto v0.0.0-20200312145019-da6875a35672 h1:jiDSspVssiikoRP google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940 h1:MRHtG0U6SnaUb+s+LhNE1qt1FQ1wlhqr5E4usBKC0uA= google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84 h1:pSLkPbrjnPyLDYUO2VM9mDLqo2V6CFBY84lFSZAfoi4= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -538,6 +541,7 @@ google.golang.org/protobuf v1.21.0 h1:qdOKuR/EIArgaWNjetjgTzgVTAZ+S/WXVrq9HW9zim google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.22.0 h1:cJv5/xdbk1NnMPR1VP9+HU6gupuG9MLBoH1r6RHZ2MY= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= gopkg.in/DataDog/dd-trace-go.v1 v1.22.0 h1:gpWsqqkwUldNZXGJqT69NU9MdEDhLboK1C4nMgR0MWw= gopkg.in/DataDog/dd-trace-go.v1 v1.22.0/go.mod h1:DVp8HmDh8PuTu2Z0fVVlBsyWaC++fzwVCaGWylTe3tg= diff --git a/server/config.go b/server/config.go index a532efde5..b4ed625b5 100644 --- a/server/config.go +++ b/server/config.go @@ -34,7 +34,7 @@ type Config struct { // JSONContentType can be used to override the default JSONContentType. JSONContentType *string `envconfig:"GIZMO_JSON_CONTENT_TYPE"` // MaxHeaderBytes can be used to override the default MaxHeaderBytes (1<<20). - MaxHeaderBytes *int `envconfig:"GIZMO_JSON_CONTENT_TYPE"` + MaxHeaderBytes *int `envconfig:"GIZMO_MAX_HEADER_BYTES"` // ReadTimeout can be used to override the default http server timeout of 10s. // The string should be formatted like a time.Duration string. ReadTimeout *string `envconfig:"GIZMO_READ_TIMEOUT"` diff --git a/server/kit/kitserver_test.go b/server/kit/kitserver_test.go index 0250fd61e..c13fa4cc9 100644 --- a/server/kit/kitserver_test.go +++ b/server/kit/kitserver_test.go @@ -234,5 +234,5 @@ func (s *server) getCatByName(ctx context.Context, _ interface{}) (interface{}, } func (s *server) error(ctx context.Context, _ interface{}) (interface{}, error) { - return nil, errors.New("doh!") + return nil, errors.New("doh") }