Skip to content

Commit

Permalink
Merge pull request #44 from cyberark/fix-snyk
Browse files Browse the repository at this point in the history
Ignore Snyk Code issues
  • Loading branch information
szh authored Nov 4, 2024
2 parents 1a872cf + 29fe03a commit cb51ba1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions ntlm.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows

package mssql
Expand Down Expand Up @@ -188,6 +189,7 @@ func clientChallenge() (nonce [8]byte) {

func ntlmSessionResponse(clientNonce [8]byte, serverChallenge [8]byte, password string) [24]byte {
var sessionHash [16]byte
// deepcode ignore InsecureHash: This is necessary for legacy support
h := md5.New()
h.Write(serverChallenge[:])
h.Write(clientNonce[:])
Expand Down
8 changes: 5 additions & 3 deletions tds.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"net"
"sort"
"strconv"
Expand Down Expand Up @@ -257,7 +257,7 @@ func readPreloginWithPacketType(
if err != nil {
return nil, err
}
struct_buf, err := ioutil.ReadAll(r)
struct_buf, err := io.ReadAll(r)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -1119,7 +1119,7 @@ initiate_connection:
if encrypt != EncryptNotSup {
var config tls.Config
if p.certificate != "" {
pem, err := ioutil.ReadFile(p.certificate)
pem, err := os.ReadFile(p.certificate)
if err != nil {
return nil, fmt.Errorf("Cannot read certificate %q: %v", p.certificate, err)
}
Expand All @@ -1132,9 +1132,11 @@ initiate_connection:
config.RootCAs = certs
}
if p.trustServerCertificate {
// deepcode ignore TooPermissiveTrustManager: This is disabled by default
config.InsecureSkipVerify = true // #nosec
}
if p.disableVerifyHostname {
// deepcode ignore TooPermissiveTrustManager: This is disabled by default
config.InsecureSkipVerify = true // #nosec
}
config.ServerName = p.hostInCertificate
Expand Down
2 changes: 2 additions & 0 deletions tds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func TestSendLogin(t *testing.T) {
OptionFlags3: 8,
HostName: "subdev1",
UserName: "test",
// file deepcode ignore HardcodedPassword/test: This is a test file
Password: "testpwd",
AppName: "appname",
ServerName: "servername",
Expand Down Expand Up @@ -72,6 +73,7 @@ func TestSendLogin(t *testing.T) {

func TestReadLogin(t *testing.T) {
fail := func (name string, expected, actual interface{}) {
// file deepcode ignore ClearTextLogging/test: This is a test file
fmt.Println("Expected:", expected)
fmt.Println("Returned:", actual)
t.Errorf("input output don't match for %s", name)
Expand Down

0 comments on commit cb51ba1

Please sign in to comment.