Skip to content

Commit

Permalink
Set minimum version of TLS to 1.2 (#364)
Browse files Browse the repository at this point in the history
* Set minimum version of TLS to 1.2

When creating an HTTP client set the minimum version of TLS to 1.2 and
prefer server ciphers.

* add Go 1.12 to CI and remove master

* fix test bug uncovered by `go vet` in Go 1.12

* remove preferServerCipherSuites
  • Loading branch information
jhendrixMSFT authored Mar 5, 2019
1 parent f4369d4 commit 134ac34
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
8 changes: 2 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ sudo: false
language: go

go:
- master
- 1.11.x
- 1.10.x

matrix:
allow_failures:
- go: master
- 1.11.x
- 1.12.x

env:
- DEP_VERSION="0.5.0"
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## v11.5.1

### Bug Fixes

- In `Client.sender()` set the minimum TLS version on HTTP clients to 1.2.

## v11.5.0

### New Features
Expand Down
4 changes: 2 additions & 2 deletions autorest/adal/persist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,13 @@ func TestSaveToken(t *testing.T) {
var actualToken Token
var expectedToken Token

json.Unmarshal([]byte(MockTokenJSON), expectedToken)
json.Unmarshal([]byte(MockTokenJSON), &expectedToken)

contents, err := ioutil.ReadFile(f.Name())
if err != nil {
t.Fatal("!!")
}
json.Unmarshal(contents, actualToken)
json.Unmarshal(contents, &actualToken)

if !reflect.DeepEqual(actualToken, expectedToken) {
t.Fatal("azure: token was not serialized correctly")
Expand Down
6 changes: 6 additions & 0 deletions autorest/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package autorest

import (
"bytes"
"crypto/tls"
"fmt"
"io"
"io/ioutil"
Expand Down Expand Up @@ -230,6 +231,11 @@ func (c Client) Do(r *http.Request) (*http.Response, error) {
func (c Client) sender() Sender {
if c.Sender == nil {
j, _ := cookiejar.New(nil)
tracing.Transport.Base = &http.Transport{
TLSClientConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
},
}
client := &http.Client{Jar: j, Transport: tracing.Transport}
return client
}
Expand Down
2 changes: 1 addition & 1 deletion autorest/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"runtime"
)

const number = "v11.5.0"
const number = "v11.5.1"

var (
userAgent = fmt.Sprintf("Go/%s (%s-%s) go-autorest/%s",
Expand Down

0 comments on commit 134ac34

Please sign in to comment.