Skip to content

Commit

Permalink
cwe fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
KshitijaKakde committed Jul 19, 2024
1 parent 3b21694 commit 0e155ab
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions cmd/karavictl/cmd/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ func New(
host: host,
}

if opts.Insecure { // #nosec G402
if opts.Insecure {
c.http.Transport = &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
InsecureSkipVerify: true, // #nosec G402
MinVersion: tls.VersionTLS13,
},
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/karavictl/cmd/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,13 @@ func createRoleServiceClient(addr string, insecure bool) (pb.RoleServiceClient,
var conn *grpc.ClientConn
var err error

if insecure { // #nosec G402
if insecure {
conn, err = grpc.Dial(addr,
grpc.WithTimeout(10*time.Second),
grpc.WithContextDialer(func(_ context.Context, addr string) (net.Conn, error) {
return tls.Dial("tcp", addr, &tls.Config{
return tls.Dial("tcp", addr, &tls.Config{ // #nosec G402
NextProtos: []string{"h2"},
InsecureSkipVerify: true,
InsecureSkipVerify: true, // #nosec G402
})
}),
grpc.WithInsecure())
Expand Down
4 changes: 2 additions & 2 deletions cmd/karavictl/cmd/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ func createStorageServiceClient(addr string, insecure bool) (pb.StorageServiceCl
var conn *grpc.ClientConn
var err error

if insecure { // #nosec G402
if insecure {
conn, err = grpc.Dial(addr,
grpc.WithTimeout(10*time.Second),
grpc.WithContextDialer(func(_ context.Context, addr string) (net.Conn, error) {
return tls.Dial("tcp", addr, &tls.Config{
NextProtos: []string{"h2"},
InsecureSkipVerify: true,
InsecureSkipVerify: true, // #nosec G402
})
}),
grpc.WithInsecure())
Expand Down
8 changes: 4 additions & 4 deletions cmd/sidecar-proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ func (pi *ProxyInstance) Start(proxyHost, access, refresh string) error {
Host: proxyHost,
}
pi.rp = httputil.NewSingleHostReverseProxy(&proxyURL)
if insecureProxy { // #nosec G402
if insecureProxy {
pi.rp.Transport = &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
InsecureSkipVerify: true, // #nosec G402
MinVersion: tls.VersionTLS12,
MaxVersion: tls.VersionTLS13,
CipherSuites: GetSecuredCipherSuites(),
Expand Down Expand Up @@ -347,10 +347,10 @@ func refreshTokens(proxyHost url.URL, refreshToken string, accessToken *string,
return err
}
httpClient := &http.Client{}
if insecureProxy { // #nosec G402
if insecureProxy {
httpClient.Transport = &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
InsecureSkipVerify: true, // #nosec G402
MinVersion: tls.VersionTLS12,
MaxVersion: tls.VersionTLS13,
CipherSuites: GetSecuredCipherSuites(),
Expand Down

0 comments on commit 0e155ab

Please sign in to comment.