Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestTLSClientBadAuth fails on go1.12 #87

Closed
im-kulikov opened this issue Mar 6, 2019 · 4 comments
Closed

TestTLSClientBadAuth fails on go1.12 #87

im-kulikov opened this issue Mar 6, 2019 · 4 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@im-kulikov
Copy link

func TestTLSClientBadAuth(t *testing.T) {
require := require.New(t)
c, cleanup := genCerts(t)
defer cleanup()
addr, _, stop := startTLSServer(t, c.CAs)
defer stop()
badConfig := &TLSConfig{}
badtls, err := badConfig.BuildClient()
require.NoError(err)
_, err = Get("https://"+addr+"/", SendTLS(badtls))
require.True(IsNetworkError(err))
}

// IsNetworkError returns true if err is a NetworkError.
func IsNetworkError(err error) bool {
	_, ok := err.(NetworkError)
	return ok
}

You expect, that error is an NetworkError, but on go1.12 it fails with:

2019/03/06 11:50:04 http: TLS handshake error from [::1]:51121: remote error: tls: bad certificate
(httputil.StatusError) GET http://[::]:51120/ 400: Client sent an HTTP request to an HTTPS server.
@im-kulikov
Copy link
Author

to reproduce with go.modules, you can use this go.mod:

module github.com/uber/kraken

go 1.12

require (
	github.com/Sirupsen/logrus v0.7.3 // indirect
	github.com/alecthomas/kingpin v2.2.6+incompatible
	github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect
	github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect
	github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129
	github.com/apache/thrift v0.0.0-20161221203622-b2a4d4ae21c7 // indirect
	github.com/aws/aws-sdk-go v1.17.6
	github.com/bitly/go-simplejson v0.5.0 // indirect
	github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
	github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd // indirect
	github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b // indirect
	github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0 // indirect
	github.com/c2h5oh/datasize v0.0.0-20171227191756-4eba002a5eae
	github.com/cactus/go-statsd-client v3.1.1+incompatible
	github.com/cenkalti/backoff v2.1.1+incompatible
	github.com/docker/distribution v2.6.2+incompatible
	github.com/docker/docker-credential-helpers v0.6.1
	github.com/docker/engine-api v0.0.0-20160908232104-4290f40c0566
	github.com/docker/go-connections v0.0.0-20180821093606-97c2040d34df // indirect
	github.com/docker/go-units v0.0.0-20181030082039-2fb04c6466a5 // indirect
	github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1 // indirect
	github.com/garyburd/redigo v1.6.0
	github.com/go-sql-driver/mysql v1.4.1 // indirect
	github.com/golang/mock v1.2.0
	github.com/golang/protobuf v1.2.0
	github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33 // indirect
	github.com/gorilla/mux v1.7.0
	github.com/inconshreveable/mousetrap v1.0.0 // indirect
	github.com/jackpal/bencode-go v0.0.0-20160320203703-8b8d9a9b37fc
	github.com/jmoiron/sqlx v0.0.0-20180406164412-2aeb6a910c2b
	github.com/kr/pretty v0.1.0 // indirect
	github.com/lib/pq v1.0.0 // indirect
	github.com/mattn/go-sqlite3 v1.6.0
	github.com/miekg/dns v0.0.0-20180406150955-01d59357d468 // indirect
	github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f // indirect
	github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2
	github.com/pkg/errors v0.8.1 // indirect
	github.com/pressly/chi v2.1.0+incompatible
	github.com/pressly/goose v0.0.0-20161209180630-f9980cee2589
	github.com/satori/go.uuid v1.2.0
	github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72
	github.com/spf13/cobra v0.0.3
	github.com/spf13/pflag v1.0.3 // indirect
	github.com/stevvooe/resumable v0.0.0-20150521211217-51ad44105773 // indirect
	github.com/stretchr/testify v1.3.0
	github.com/uber-go/tally v3.3.8+incompatible
	github.com/willf/bitset v0.0.0-20180426185212-8ce1146b8621
	github.com/xenolf/lego v0.3.2-0.20160610184743-c8b0781028a2 // indirect
	github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43 // indirect
	github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50 // indirect
	github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f // indirect
	go.uber.org/atomic v1.3.2
	go.uber.org/multierr v1.1.0 // indirect
	go.uber.org/zap v1.9.1
	golang.org/x/crypto v0.0.0-20180312195533-182114d58262 // indirect
	golang.org/x/net v0.0.0-20180906233101-161cd47e91fd // indirect
	golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f
	golang.org/x/time v0.0.0-20160202183820-a4bde1265759
	google.golang.org/appengine v1.4.0 // indirect
	gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
	gopkg.in/square/go-jose.v1 v1.1.2 // indirect
	gopkg.in/validator.v2 v2.0.0-20180205153750-59c90c7046f6
	gopkg.in/yaml.v2 v2.0.0-20150116202057-bef53efd0c76
	rsc.io/letsencrypt v0.0.0-20160420184355-a019c9e6fce0 // indirect
)

@yiranwang52 yiranwang52 added bug Something isn't working good first issue Good for newcomers labels Mar 6, 2019
@oscar2d2
Copy link

oscar2d2 commented Mar 7, 2019

#97 I have submitted a PR for this. Please review and comment. Thanks.

@evelynl94
Copy link
Collaborator

I suspect it is caused by the difference between go1.11 and go1.12...needs to verify it, thou

@im-kulikov
Copy link
Author

im-kulikov commented Mar 9, 2019

@evelynl94 As I say in topic start, problem with Go 1.12:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants