From cb0ca66a6b3e457990465aae0c4f3e73e8ce536f Mon Sep 17 00:00:00 2001 From: subhamkrai Date: Mon, 5 Oct 2020 13:27:44 +0530 Subject: [PATCH] ci: enable gosec linter in golangci-lint golangci-lint linter gosec showing more errors than gosec gh. This commit resolve new errors. And, removing nosec comments from autogenerated files. Signed-off-by: subhamkrai --- .github/workflows/golangci-lint.yaml | 3 ++- .github/workflows/gosec.yaml | 15 --------------- build/codegen/codegen.sh | 2 -- .../v1alpha1/zz_generated.deepcopy.go | 1 - pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go | 1 - .../v1alpha1/zz_generated.deepcopy.go | 1 - .../edgefs.rook.io/v1/zz_generated.deepcopy.go | 1 - .../nfs.rook.io/v1alpha1/zz_generated.deepcopy.go | 1 - pkg/apis/rook.io/v1/zz_generated.deepcopy.go | 1 - .../rook.io/v1alpha2/zz_generated.deepcopy.go | 1 - .../v1alpha1/zz_generated.deepcopy.go | 1 - pkg/daemon/ceph/client/mirror_test.go | 2 +- pkg/daemon/ceph/util/util_test.go | 4 ++-- pkg/daemon/util/cmdreporter_test.go | 2 +- pkg/operator/ceph/client/controller_test.go | 4 ++-- pkg/operator/ceph/cluster/mon/config_test.go | 4 ++-- pkg/operator/ceph/cluster/mon/health_test.go | 3 ++- pkg/operator/ceph/cluster/osd/health_test.go | 3 ++- pkg/operator/ceph/cluster/rbd/controller_test.go | 2 +- tests/framework/installer/ceph_installer.go | 4 ++-- tests/framework/installer/ceph_manifests.go | 4 ++-- tests/framework/installer/ceph_manifests_v1.2.go | 4 ++-- tests/framework/installer/provisioners.go | 2 +- tests/framework/utils/exec_utils.go | 2 +- tests/framework/utils/k8s_helper.go | 4 ++-- tests/framework/utils/mysql_helper.go | 4 ++-- tests/integration/ceph_base_file_test.go | 2 +- 27 files changed, 28 insertions(+), 50 deletions(-) delete mode 100644 .github/workflows/gosec.yaml diff --git a/.github/workflows/golangci-lint.yaml b/.github/workflows/golangci-lint.yaml index 6941b6d97..c2076194e 100644 --- a/.github/workflows/golangci-lint.yaml +++ b/.github/workflows/golangci-lint.yaml @@ -24,6 +24,7 @@ jobs: # working-directory: somedir # Optional: golangci-lint command line arguments. - args: --timeout=4m + args: -E gosec --timeout=4m + # Optional: show only new issues if it's a pull request. The default value is `false`. # only-new-issues: true diff --git a/.github/workflows/gosec.yaml b/.github/workflows/gosec.yaml deleted file mode 100644 index 5f768461b..000000000 --- a/.github/workflows/gosec.yaml +++ /dev/null @@ -1,15 +0,0 @@ -name: Gosec -on: [push, pull_request] - -jobs: - tests: - runs-on: ubuntu-latest - env: - GO111MODULE: on - steps: - - name: Checkout Source - uses: actions/checkout@v2 - - name: Run Gosec Security Scanner - uses: securego/gosec@master - with: - args: pkg/... -severity=medium && cmd/... -severity=medium diff --git a/build/codegen/codegen.sh b/build/codegen/codegen.sh index 0e7380004..903100e81 100755 --- a/build/codegen/codegen.sh +++ b/build/codegen/codegen.sh @@ -62,6 +62,4 @@ find "${scriptdir}/../../pkg/client" -name "*.go" -exec \ find "${scriptdir}/../../pkg/client" -name "*.go" -exec \ $SED 's/cephNFSs/cephNFSes/g' {} + find "${scriptdir}/../../pkg/client" -name "*.go.bak" -delete -find "${scriptdir}/../../pkg/apis" -name "zz_generated.deepcopy.go" -exec \ - $SED '/DO NOT EDIT./a // #nosec G601 Check for implicit memory aliasing of items from a range statement' {} + find "${scriptdir}/../../pkg/apis" -name "zz_generated.deepcopy.go.bak" -delete diff --git a/pkg/apis/cassandra.rook.io/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/cassandra.rook.io/v1alpha1/zz_generated.deepcopy.go index 4aad13952..731915d26 100644 --- a/pkg/apis/cassandra.rook.io/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/cassandra.rook.io/v1alpha1/zz_generated.deepcopy.go @@ -17,7 +17,6 @@ limitations under the License. */ // Code generated by deepcopy-gen. DO NOT EDIT. -// #nosec G601 Check for implicit memory aliasing of items from a range statement package v1alpha1 diff --git a/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go b/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go index 75206d2ba..b18757df4 100644 --- a/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go +++ b/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go @@ -17,7 +17,6 @@ limitations under the License. */ // Code generated by deepcopy-gen. DO NOT EDIT. -// #nosec G601 Check for implicit memory aliasing of items from a range statement package v1 diff --git a/pkg/apis/cockroachdb.rook.io/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/cockroachdb.rook.io/v1alpha1/zz_generated.deepcopy.go index 0baf5c416..9eda4448d 100644 --- a/pkg/apis/cockroachdb.rook.io/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/cockroachdb.rook.io/v1alpha1/zz_generated.deepcopy.go @@ -17,7 +17,6 @@ limitations under the License. */ // Code generated by deepcopy-gen. DO NOT EDIT. -// #nosec G601 Check for implicit memory aliasing of items from a range statement package v1alpha1 diff --git a/pkg/apis/edgefs.rook.io/v1/zz_generated.deepcopy.go b/pkg/apis/edgefs.rook.io/v1/zz_generated.deepcopy.go index 3e086725b..51ca2f859 100644 --- a/pkg/apis/edgefs.rook.io/v1/zz_generated.deepcopy.go +++ b/pkg/apis/edgefs.rook.io/v1/zz_generated.deepcopy.go @@ -17,7 +17,6 @@ limitations under the License. */ // Code generated by deepcopy-gen. DO NOT EDIT. -// #nosec G601 Check for implicit memory aliasing of items from a range statement package v1 diff --git a/pkg/apis/nfs.rook.io/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/nfs.rook.io/v1alpha1/zz_generated.deepcopy.go index b552796d4..d13b29bcc 100644 --- a/pkg/apis/nfs.rook.io/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/nfs.rook.io/v1alpha1/zz_generated.deepcopy.go @@ -17,7 +17,6 @@ limitations under the License. */ // Code generated by deepcopy-gen. DO NOT EDIT. -// #nosec G601 Check for implicit memory aliasing of items from a range statement package v1alpha1 diff --git a/pkg/apis/rook.io/v1/zz_generated.deepcopy.go b/pkg/apis/rook.io/v1/zz_generated.deepcopy.go index 59021b529..8d42bf428 100644 --- a/pkg/apis/rook.io/v1/zz_generated.deepcopy.go +++ b/pkg/apis/rook.io/v1/zz_generated.deepcopy.go @@ -17,7 +17,6 @@ limitations under the License. */ // Code generated by deepcopy-gen. DO NOT EDIT. -// #nosec G601 Check for implicit memory aliasing of items from a range statement package v1 diff --git a/pkg/apis/rook.io/v1alpha2/zz_generated.deepcopy.go b/pkg/apis/rook.io/v1alpha2/zz_generated.deepcopy.go index 41cf4dc20..6b225b362 100644 --- a/pkg/apis/rook.io/v1alpha2/zz_generated.deepcopy.go +++ b/pkg/apis/rook.io/v1alpha2/zz_generated.deepcopy.go @@ -17,7 +17,6 @@ limitations under the License. */ // Code generated by deepcopy-gen. DO NOT EDIT. -// #nosec G601 Check for implicit memory aliasing of items from a range statement package v1alpha2 diff --git a/pkg/apis/yugabytedb.rook.io/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/yugabytedb.rook.io/v1alpha1/zz_generated.deepcopy.go index f2860c4cc..10220a7d5 100644 --- a/pkg/apis/yugabytedb.rook.io/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/yugabytedb.rook.io/v1alpha1/zz_generated.deepcopy.go @@ -17,7 +17,6 @@ limitations under the License. */ // Code generated by deepcopy-gen. DO NOT EDIT. -// #nosec G601 Check for implicit memory aliasing of items from a range statement package v1alpha1 diff --git a/pkg/daemon/ceph/client/mirror_test.go b/pkg/daemon/ceph/client/mirror_test.go index 865ebbd08..d295d2920 100644 --- a/pkg/daemon/ceph/client/mirror_test.go +++ b/pkg/daemon/ceph/client/mirror_test.go @@ -27,7 +27,7 @@ import ( ) var ( - bootstrapPeerToken = `eyJmc2lkIjoiYzZiMDg3ZjItNzgyOS00ZGJiLWJjZmMtNTNkYzM0ZTBiMzVkIiwiY2xpZW50X2lkIjoicmJkLW1pcnJvci1wZWVyIiwia2V5IjoiQVFBV1lsWmZVQ1Q2RGhBQVBtVnAwbGtubDA5YVZWS3lyRVV1NEE9PSIsIm1vbl9ob3N0IjoiW3YyOjE5Mi4xNjguMTExLjEwOjMzMDAsdjE6MTkyLjE2OC4xMTEuMTA6Njc4OV0sW3YyOjE5Mi4xNjguMTExLjEyOjMzMDAsdjE6MTkyLjE2OC4xMTEuMTI6Njc4OV0sW3YyOjE5Mi4xNjguMTExLjExOjMzMDAsdjE6MTkyLjE2OC4xMTEuMTE6Njc4OV0ifQ==` + bootstrapPeerToken = `eyJmc2lkIjoiYzZiMDg3ZjItNzgyOS00ZGJiLWJjZmMtNTNkYzM0ZTBiMzVkIiwiY2xpZW50X2lkIjoicmJkLW1pcnJvci1wZWVyIiwia2V5IjoiQVFBV1lsWmZVQ1Q2RGhBQVBtVnAwbGtubDA5YVZWS3lyRVV1NEE9PSIsIm1vbl9ob3N0IjoiW3YyOjE5Mi4xNjguMTExLjEwOjMzMDAsdjE6MTkyLjE2OC4xMTEuMTA6Njc4OV0sW3YyOjE5Mi4xNjguMTExLjEyOjMzMDAsdjE6MTkyLjE2OC4xMTEuMTI6Njc4OV0sW3YyOjE5Mi4xNjguMTExLjExOjMzMDAsdjE6MTkyLjE2OC4xMTEuMTE6Njc4OV0ifQ==` //nolint:gosec // This is just a var name, not a real token mirrorStatus = `{"summary":{"health":"WARNING","daemon_health":"OK","image_health":"WARNING","states":{"starting_replay":1,"replaying":1}}}` mirrorInfo = `{"mode":"image","site_name":"39074576-5884-4ef3-8a4d-8a0c5ed33031","peers":[{"uuid":"4a6983c0-3c9d-40f5-b2a9-2334a4659827","direction":"rx-tx","site_name":"ocs","mirror_uuid":"","client_name":"client.rbd-mirror-peer"}]}` ) diff --git a/pkg/daemon/ceph/util/util_test.go b/pkg/daemon/ceph/util/util_test.go index 53b3181a6..b56bc3c40 100644 --- a/pkg/daemon/ceph/util/util_test.go +++ b/pkg/daemon/ceph/util/util_test.go @@ -35,9 +35,9 @@ func TestFindDevicePath(t *testing.T) { dev0Path := filepath.Join(mockRBDSysBusPath, "devices", "3") err = os.MkdirAll(dev0Path, 0777) assert.NoError(t, err) - err = ioutil.WriteFile(filepath.Join(dev0Path, "name"), []byte("myimage1"), 0777) + err = ioutil.WriteFile(filepath.Join(dev0Path, "name"), []byte("myimage1"), 0600) assert.NoError(t, err) - err = ioutil.WriteFile(filepath.Join(dev0Path, "pool"), []byte("mypool1"), 0777) + err = ioutil.WriteFile(filepath.Join(dev0Path, "pool"), []byte("mypool1"), 0600) assert.NoError(t, err) mappedImageFile, _ := FindRBDMappedFile("myimage1", "mypool1", mockRBDSysBusPath) assert.Equal(t, "3", mappedImageFile) diff --git a/pkg/daemon/util/cmdreporter_test.go b/pkg/daemon/util/cmdreporter_test.go index 9b447cd27..38e935d08 100644 --- a/pkg/daemon/util/cmdreporter_test.go +++ b/pkg/daemon/util/cmdreporter_test.go @@ -226,7 +226,7 @@ func TestRunner_Run(t *testing.T) { func mockExecCommand(command string, args ...string) *exec.Cmd { cs := []string{"-test.run=TestCmdReporterHelperProcess", "--", command} cs = append(cs, args...) - cmd := exec.Command(os.Args[0], cs...) + cmd := exec.Command(os.Args[0], cs...) //nolint:gosec //Rook controls the input to the exec arguments // the existing environment will contain variables which define the desired return from the // fake command which will be run. cmd.Env = append(os.Environ(), "GO_WANT_HELPER_PROCESS=1") diff --git a/pkg/operator/ceph/client/controller_test.go b/pkg/operator/ceph/client/controller_test.go index ba7cd97c7..ef21eff3b 100644 --- a/pkg/operator/ceph/client/controller_test.go +++ b/pkg/operator/ceph/client/controller_test.go @@ -106,7 +106,7 @@ func TestGenerateClient(t *testing.T) { func TestCreateClient(t *testing.T) { clientset := testop.New(t, 1) - adminSecret := "AQDkLIBd9vLGJxAAnXsIKPrwvUXAmY+D1g0X1Q==" + adminSecret := "AQDkLIBd9vLGJxAAnXsIKPrwvUXAmY+D1g0X1Q==" //nolint:gosec // This is just a var name, not a real secret executor := &exectest.MockExecutor{ MockExecuteCommandWithOutputFile: func(command, outfileArg string, args ...string) (string, error) { logger.Infof("Command: %s %v", command, args) @@ -119,7 +119,7 @@ func TestCreateClient(t *testing.T) { logger.Infof("COMMAND: %s %v", command, args) if command == "ceph-authtool" && args[0] == "--create-keyring" { filename := args[1] - assert.NoError(t, ioutil.WriteFile(filename, []byte(fmt.Sprintf("key = %s", adminSecret)), 0644)) + assert.NoError(t, ioutil.WriteFile(filename, []byte(fmt.Sprintf("key = %s", adminSecret)), 0600)) } return "", nil }, diff --git a/pkg/operator/ceph/cluster/mon/config_test.go b/pkg/operator/ceph/cluster/mon/config_test.go index c3b7812b5..f776267b0 100644 --- a/pkg/operator/ceph/cluster/mon/config_test.go +++ b/pkg/operator/ceph/cluster/mon/config_test.go @@ -37,13 +37,13 @@ func TestCreateClusterSecrets(t *testing.T) { err := os.MkdirAll(configDir, 0755) assert.NoError(t, err) defer os.RemoveAll(configDir) - adminSecret := "AQDkLIBd9vLGJxAAnXsIKPrwvUXAmY+D1g0X1Q==" + adminSecret := "AQDkLIBd9vLGJxAAnXsIKPrwvUXAmY+D1g0X1Q==" //nolint:gosec // This is just a var name, not a real secret executor := &exectest.MockExecutor{ MockExecuteCommandWithOutput: func(command string, args ...string) (string, error) { logger.Infof("COMMAND: %s %v", command, args) if command == "ceph-authtool" && args[0] == "--create-keyring" { filename := args[1] - assert.NoError(t, ioutil.WriteFile(filename, []byte(fmt.Sprintf("key = %s", adminSecret)), 0644)) + assert.NoError(t, ioutil.WriteFile(filename, []byte(fmt.Sprintf("key = %s", adminSecret)), 0600)) } return "", nil }, diff --git a/pkg/operator/ceph/cluster/mon/health_test.go b/pkg/operator/ceph/cluster/mon/health_test.go index 9ad915379..41fcfd2a5 100644 --- a/pkg/operator/ceph/cluster/mon/health_test.go +++ b/pkg/operator/ceph/cluster/mon/health_test.go @@ -412,7 +412,8 @@ func TestForceDeleteFailedMon(t *testing.T) { assert.NoError(t, err) for _, node := range nodes.Items { node.Status.Conditions[0].Status = v1.ConditionFalse - _, err := context.Clientset.CoreV1().Nodes().Update(&node) + localnode := node + _, err := context.Clientset.CoreV1().Nodes().Update(&localnode) assert.NoError(t, err) } diff --git a/pkg/operator/ceph/cluster/osd/health_test.go b/pkg/operator/ceph/cluster/osd/health_test.go index f40f43b6b..494918bd1 100644 --- a/pkg/operator/ceph/cluster/osd/health_test.go +++ b/pkg/operator/ceph/cluster/osd/health_test.go @@ -162,7 +162,8 @@ func TestOSDRestartIfStuck(t *testing.T) { assert.NoError(t, err) for _, node := range nodes.Items { node.Status.Conditions[0].Status = v1.ConditionFalse - _, err := context.Clientset.CoreV1().Nodes().Update(&node) + localnode := node + _, err := context.Clientset.CoreV1().Nodes().Update(&localnode) assert.NoError(t, err) } diff --git a/pkg/operator/ceph/cluster/rbd/controller_test.go b/pkg/operator/ceph/cluster/rbd/controller_test.go index a47db0138..6f7daa551 100644 --- a/pkg/operator/ceph/cluster/rbd/controller_test.go +++ b/pkg/operator/ceph/cluster/rbd/controller_test.go @@ -217,7 +217,7 @@ func TestCephRBDMirrorController(t *testing.T) { assert.True(t, res.Requeue) logger.Info("STARTING PHASE 5") - bootstrapPeerToken := `eyJmc2lkIjoiYzZiMDg3ZjItNzgyOS00ZGJiLWJjZmMtNTNkYzM0ZTBiMzVkIiwiY2xpZW50X2lkIjoicmJkLW1pcnJvci1wZWVyIiwia2V5IjoiQVFBV1lsWmZVQ1Q2RGhBQVBtVnAwbGtubDA5YVZWS3lyRVV1NEE9PSIsIm1vbl9ob3N0IjoiW3YyOjE5Mi4xNjguMTExLjEwOjMzMDAsdjE6MTkyLjE2OC4xMTEuMTA6Njc4OV0sW3YyOjE5Mi4xNjguMTExLjEyOjMzMDAsdjE6MTkyLjE2OC4xMTEuMTI6Njc4OV0sW3YyOjE5Mi4xNjguMTExLjExOjMzMDAsdjE6MTkyLjE2OC4xMTEuMTE6Njc4OV0ifQ==` + bootstrapPeerToken := `eyJmc2lkIjoiYzZiMDg3ZjItNzgyOS00ZGJiLWJjZmMtNTNkYzM0ZTBiMzVkIiwiY2xpZW50X2lkIjoicmJkLW1pcnJvci1wZWVyIiwia2V5IjoiQVFBV1lsWmZVQ1Q2RGhBQVBtVnAwbGtubDA5YVZWS3lyRVV1NEE9PSIsIm1vbl9ob3N0IjoiW3YyOjE5Mi4xNjguMTExLjEwOjMzMDAsdjE6MTkyLjE2OC4xMTEuMTA6Njc4OV0sW3YyOjE5Mi4xNjguMTExLjEyOjMzMDAsdjE6MTkyLjE2OC4xMTEuMTI6Njc4OV0sW3YyOjE5Mi4xNjguMTExLjExOjMzMDAsdjE6MTkyLjE2OC4xMTEuMTE6Njc4OV0ifQ==` //nolint:gosec // This is just a var name, not a real token peerSecret := &v1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: peerSecretName, diff --git a/tests/framework/installer/ceph_installer.go b/tests/framework/installer/ceph_installer.go index 721c40a67..164138f11 100644 --- a/tests/framework/installer/ceph_installer.go +++ b/tests/framework/installer/ceph_installer.go @@ -392,7 +392,7 @@ func (h *CephInstaller) GetRookExternalClusterMonConfigMap(namespace string) (*v // GetRookExternalClusterMonSecret gets the monitor kubernetes secret of the external cluster func (h *CephInstaller) GetRookExternalClusterMonSecret(namespace string) (*v1.Secret, error) { - secretName := "rook-ceph-mon" + secretName := "rook-ceph-mon" //nolint:gosec // We safely suppress gosec in tests file externalSecret, err := h.k8shelper.Clientset.CoreV1().Secrets(namespace).Get(secretName, metav1.GetOptions{}) if err != nil { @@ -427,7 +427,7 @@ func (h *CephInstaller) initTestDir(namespace string) (string, error) { } } else { // Compose a random test directory name without actually creating it since not running on the localhost - r := rand.Int() + r := rand.Int() //nolint:gosec // We safely suppress gosec in tests file testDir = path.Join(testDir, fmt.Sprintf("test-%d", r)) } return testDir, nil diff --git a/tests/framework/installer/ceph_manifests.go b/tests/framework/installer/ceph_manifests.go index a18b7e97a..c82144768 100644 --- a/tests/framework/installer/ceph_manifests.go +++ b/tests/framework/installer/ceph_manifests.go @@ -2367,8 +2367,8 @@ parameters: func (m *CephManifestsMaster) GetFileStorageClassDef(fsName, storageClassName, systemNamespace, namespace string) string { // Create a CSI driver storage class - csiCephFSNodeSecret := "rook-csi-cephfs-node" - csiCephFSProvisionerSecret := "rook-csi-cephfs-provisioner" + csiCephFSNodeSecret := "rook-csi-cephfs-node" //nolint:gosec // We safely suppress gosec in tests file + csiCephFSProvisionerSecret := "rook-csi-cephfs-provisioner" //nolint:gosec // We safely suppress gosec in tests file return ` apiVersion: storage.k8s.io/v1 kind: StorageClass diff --git a/tests/framework/installer/ceph_manifests_v1.2.go b/tests/framework/installer/ceph_manifests_v1.2.go index ed3110d22..1ff97c42d 100644 --- a/tests/framework/installer/ceph_manifests_v1.2.go +++ b/tests/framework/installer/ceph_manifests_v1.2.go @@ -1787,8 +1787,8 @@ parameters: func (m *CephManifestsV1_2) GetFileStorageClassDef(fsName, storageClassName, systemNamespace, namespace string) string { // Create a CSI driver storage class - csiCephFSNodeSecret := "rook-csi-cephfs-node" - csiCephFSProvisionerSecret := "rook-csi-cephfs-provisioner" + csiCephFSNodeSecret := "rook-csi-cephfs-node" //nolint:gosec // We safely suppress gosec in tests file + csiCephFSProvisionerSecret := "rook-csi-cephfs-provisioner" //nolint:gosec // We safely suppress gosec in tests file return ` apiVersion: storage.k8s.io/v1 kind: StorageClass diff --git a/tests/framework/installer/provisioners.go b/tests/framework/installer/provisioners.go index 68f9b282b..a3b5ab506 100644 --- a/tests/framework/installer/provisioners.go +++ b/tests/framework/installer/provisioners.go @@ -114,7 +114,7 @@ func getHostPathProvisionerDeployment() (string, error) { // The hostpath provisioner project is readonly so we can't submit a PR. // Until we replace this completely, we'll just replace the necessary string. deploymentResourceURL := fmt.Sprintf(hostPathProvisionerResourceBaseURL, hostPathProvisionerDeployment) - response, err := http.Get(deploymentResourceURL) + response, err := http.Get(deploymentResourceURL) //nolint:gosec // We safely suppress gosec in tests file if err != nil { return "", fmt.Errorf("failed to get hostpath provisioner deployment. %+v", err) } diff --git a/tests/framework/utils/exec_utils.go b/tests/framework/utils/exec_utils.go index e61297c0a..adc2d4b6b 100644 --- a/tests/framework/utils/exec_utils.go +++ b/tests/framework/utils/exec_utils.go @@ -51,7 +51,7 @@ func ExecuteCommand(cmdStruct CommandArgs) CommandOut { var outBuffer, errBuffer bytes.Buffer - cmd := exec.Command(cmdStruct.Command, cmdStruct.CmdArgs...) + cmd := exec.Command(cmdStruct.Command, cmdStruct.CmdArgs...) //nolint:gosec // We safely suppress gosec in tests file cmd.Env = append(cmd.Env, cmdStruct.EnvironmentVariable...) diff --git a/tests/framework/utils/k8s_helper.go b/tests/framework/utils/k8s_helper.go index a30757eea..e86d46b92 100644 --- a/tests/framework/utils/k8s_helper.go +++ b/tests/framework/utils/k8s_helper.go @@ -1442,7 +1442,7 @@ func (k8sh *K8sHelper) ChangeHostnames() error { if !strings.HasPrefix(hostname, hostnameTestPrefix) { node.Labels[v1.LabelHostname] = hostnameTestPrefix + hostname logger.Infof("changed hostname of node %s to %s", node.Name, node.Labels[v1.LabelHostname]) - _, err := k8sh.Clientset.CoreV1().Nodes().Update(&node) + _, err := k8sh.Clientset.CoreV1().Nodes().Update(&node) //nolint:gosec // We safely suppress gosec in tests file if err != nil { return err } @@ -1463,7 +1463,7 @@ func (k8sh *K8sHelper) RestoreHostnames() ([]string, error) { if strings.HasPrefix(hostname, hostnameTestPrefix) { node.Labels[v1.LabelHostname] = hostname[len(hostnameTestPrefix):] logger.Infof("restoring hostname of node %s to %s", node.Name, node.Labels[v1.LabelHostname]) - _, err := k8sh.Clientset.CoreV1().Nodes().Update(&node) + _, err := k8sh.Clientset.CoreV1().Nodes().Update(&node) //nolint:gosec // We safely suppress gosec in tests file if err != nil { return nil, err } diff --git a/tests/framework/utils/mysql_helper.go b/tests/framework/utils/mysql_helper.go index 5bac611c7..c7f59467b 100644 --- a/tests/framework/utils/mysql_helper.go +++ b/tests/framework/utils/mysql_helper.go @@ -81,7 +81,7 @@ func (h *MySQLHelper) InsertRandomData(dataSize int) sql.Result { } defer stmtIns.Close() - result, err := stmtIns.Exec(rand.Intn(100000000), fake.CharactersN(dataSize), fake.CharactersN(dataSize), fake.CharactersN(dataSize), fake.CharactersN(dataSize), fake.CharactersN(dataSize)) + result, err := stmtIns.Exec(rand.Intn(100000000), fake.CharactersN(dataSize), fake.CharactersN(dataSize), fake.CharactersN(dataSize), fake.CharactersN(dataSize), fake.CharactersN(dataSize)) //nolint:gosec // We safely suppress gosec in tests file if err != nil { panic(err) } @@ -139,7 +139,7 @@ func (h *MySQLHelper) DeleteRandomRow() sql.Result { } } - result1, err := h.DB.Exec("DELETE FROM LONGHAUL WHERE id= " + strconv.Itoa(id)) + result1, err := h.DB.Exec("DELETE FROM LONGHAUL WHERE id= " + strconv.Itoa(id)) //nolint:gosec // We safely suppress gosec in tests file if err != nil { panic(err) } diff --git a/tests/integration/ceph_base_file_test.go b/tests/integration/ceph_base_file_test.go index e8f1307b1..d64bf4934 100644 --- a/tests/integration/ceph_base_file_test.go +++ b/tests/integration/ceph_base_file_test.go @@ -38,7 +38,7 @@ const ( filePodName = "file-test" fileMountUserPodName = "file-mountuser-test" fileMountUser = "filemountuser" - fileMountSecret = "file-mountuser-cephkey" + fileMountSecret = "file-mountuser-cephkey" //nolint:gosec // We safely suppress gosec in tests file ) func fileSystemCSICloneTest(helper *clients.TestClient, k8sh *utils.K8sHelper, s suite.Suite, storageClassName, systemNamespace string) {