diff options
author | Duco van Amstel <duco.vanamstel@gmail.com> | 2018-12-05 23:40:55 +0000 |
---|---|---|
committer | Wim <wim@42.be> | 2018-12-06 00:40:55 +0100 |
commit | af7a00d030b89a0fa1c85da8f3a1485c8a757fa1 (patch) | |
tree | e7d2a3e0f309eca268f4ff3599468c5af94d169a | |
parent | 8a7efce941acf7123481d58c6bf5b5421c25736d (diff) | |
download | matterbridge-msglm-af7a00d030b89a0fa1c85da8f3a1485c8a757fa1.tar.gz matterbridge-msglm-af7a00d030b89a0fa1c85da8f3a1485c8a757fa1.tar.bz2 matterbridge-msglm-af7a00d030b89a0fa1c85da8f3a1485c8a757fa1.zip |
Enable gosec linter (#645)
-rw-r--r-- | .golangci.yaml | 1 | ||||
-rw-r--r-- | gateway/gateway.go | 4 | ||||
-rw-r--r-- | hook/rockethook/rockethook.go | 2 | ||||
-rw-r--r-- | matterclient/helpers.go | 14 | ||||
-rw-r--r-- | matterhook/matterhook.go | 2 |
5 files changed, 14 insertions, 9 deletions
diff --git a/.golangci.yaml b/.golangci.yaml index eafe55de..ac3f34b8 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -178,7 +178,6 @@ linters: - errcheck - gochecknoglobals - gocyclo - - gosec - lll - maligned - prealloc diff --git a/gateway/gateway.go b/gateway/gateway.go index 2874ef24..0ee7a616 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -2,7 +2,7 @@ package gateway import ( "bytes" - "crypto/sha1" + "crypto/sha1" //nolint:gosec "fmt" "io/ioutil" "net/http" @@ -466,7 +466,7 @@ func (gw *Gateway) handleFiles(msg *config.Message) { fi.Name = reg.ReplaceAllString(fi.Name, "_") fi.Name += ext - sha1sum := fmt.Sprintf("%x", sha1.Sum(*fi.Data))[:8] + sha1sum := fmt.Sprintf("%x", sha1.Sum(*fi.Data))[:8] //nolint:gosec if gw.BridgeValues().General.MediaServerUpload != "" { // Use MediaServerUpload. Upload using a PUT HTTP request and basicauth. diff --git a/hook/rockethook/rockethook.go b/hook/rockethook/rockethook.go index 063be742..1ac8cb02 100644 --- a/hook/rockethook/rockethook.go +++ b/hook/rockethook/rockethook.go @@ -38,7 +38,7 @@ type Config struct { func New(url string, config Config) *Client { c := &Client{In: make(chan Message), Config: config} tr := &http.Transport{ - TLSClientConfig: &tls.Config{InsecureSkipVerify: config.InsecureSkipVerify}, + TLSClientConfig: &tls.Config{InsecureSkipVerify: config.InsecureSkipVerify}, //nolint:gosec } c.httpclient = &http.Client{Transport: tr} _, _, err := net.SplitHostPort(c.BindAddress) diff --git a/matterclient/helpers.go b/matterclient/helpers.go index 74936abf..05497311 100644 --- a/matterclient/helpers.go +++ b/matterclient/helpers.go @@ -1,7 +1,7 @@ package matterclient import ( - "crypto/md5" + "crypto/md5" //nolint:gosec "crypto/tls" "errors" "fmt" @@ -101,7 +101,10 @@ func (m *MMClient) initClient(firstConnection bool, b *backoff.Backoff) error { } // login to mattermost m.Client = model.NewAPIv4Client(uriScheme + m.Credentials.Server) - m.Client.HttpClient.Transport = &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: m.SkipTLSVerify}, Proxy: http.ProxyFromEnvironment} + m.Client.HttpClient.Transport = &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: m.SkipTLSVerify}, //nolint:gosec + Proxy: http.ProxyFromEnvironment, + } m.Client.HttpClient.Timeout = time.Second * 10 // handle MMAUTHTOKEN and personal token @@ -206,7 +209,10 @@ func (m *MMClient) wsConnect() { m.log.Debugf("WsClient: making connection: %s", wsurl) for { - wsDialer := &websocket.Dialer{Proxy: http.ProxyFromEnvironment, TLSClientConfig: &tls.Config{InsecureSkipVerify: m.SkipTLSVerify}} + wsDialer := &websocket.Dialer{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: m.SkipTLSVerify}, //nolint:gosec + Proxy: http.ProxyFromEnvironment, + } var err error m.WsClient, _, err = wsDialer.Dial(wsurl, header) if err != nil { @@ -273,5 +279,5 @@ func supportedVersion(version string) bool { } func digestString(s string) string { - return fmt.Sprintf("%x", md5.Sum([]byte(s))) + return fmt.Sprintf("%x", md5.Sum([]byte(s))) //nolint:gosec } diff --git a/matterhook/matterhook.go b/matterhook/matterhook.go index f602ed44..f5133112 100644 --- a/matterhook/matterhook.go +++ b/matterhook/matterhook.go @@ -71,7 +71,7 @@ type Config struct { func New(url string, config Config) *Client { c := &Client{Url: url, In: make(chan IMessage), Out: make(chan OMessage), Config: config} tr := &http.Transport{ - TLSClientConfig: &tls.Config{InsecureSkipVerify: config.InsecureSkipVerify}, + TLSClientConfig: &tls.Config{InsecureSkipVerify: config.InsecureSkipVerify}, //nolint:gosec } c.httpclient = &http.Client{Transport: tr} if !c.DisableServer { |