diff --git a/.golangci.yml b/.golangci.yml index e40fc47..37afe75 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,6 +1,4 @@ run: - skip-dirs: - - test-cmds timeout: 5m linters: @@ -36,4 +34,4 @@ issues: # False positive: https://github.com/kunwardeep/paralleltest/issues/8. - linters: - paralleltest - text: "does not use range value in test Run" \ No newline at end of file + text: "does not use range value in test Run" diff --git a/cross_language_tests/aes_cross_test.go b/cross_language_tests/aes_cross_test.go index 8503c76..4604dbb 100644 --- a/cross_language_tests/aes_cross_test.go +++ b/cross_language_tests/aes_cross_test.go @@ -40,7 +40,6 @@ func TestAesRuby(t *testing.T) { {AuthData: mkrand(t, 32), Plaintext: mkrand(t, 1024)}, } - //#nosec G306 -- Need readable files for _, tt := range tests { tt := tt t.Run("", func(t *testing.T) { @@ -60,6 +59,7 @@ func TestAesRuby(t *testing.T) { b, err := msgpack.Marshal(tt) require.NoError(t, err) + //#nosec G306 -- Need readable files require.NoError(t, os.WriteFile(testfile, []byte(base64.StdEncoding.EncodeToString(b)), 0644)) }) diff --git a/cross_language_tests/boxer_cross_test.go b/cross_language_tests/boxer_cross_test.go index 7f69e12..1788d68 100644 --- a/cross_language_tests/boxer_cross_test.go +++ b/cross_language_tests/boxer_cross_test.go @@ -70,7 +70,6 @@ func TestBoxerRuby(t *testing.T) { } // Ruby Decrypt Tests - //#nosec G306 -- Need readable files for _, message := range testMessages { message := message @@ -93,6 +92,7 @@ func TestBoxerRuby(t *testing.T) { b, err := msgpack.Marshal(rubyCommand) require.NoError(t, err) + //#nosec G306 -- Need readable files require.NoError(t, os.WriteFile(rubyInFile, []byte(base64.StdEncoding.EncodeToString(b)), 0644)) ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) @@ -160,6 +160,7 @@ func TestBoxerRuby(t *testing.T) { var png bytes.Buffer pngFile := path.Join(dir, ulid.New()+".png") require.NoError(t, aliceBoxer.EncodePng(responseTo, message, &png)) + //#nosec G306 -- Need readable files require.NoError(t, os.WriteFile(pngFile, png.Bytes(), 0644)) tests := []boxerCrossTestCase{ @@ -200,6 +201,7 @@ func TestBoxerRuby(t *testing.T) { // b, err := msgpack.Marshal(tt) require.NoError(t, err) + //#nosec G306 -- Need readable files require.NoError(t, os.WriteFile(testfile, []byte(base64.StdEncoding.EncodeToString(b)), 0644)) ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) @@ -248,6 +250,7 @@ func TestBoxerRuby(t *testing.T) { b, err := msgpack.Marshal(rubyCommand) require.NoError(t, err) + //#nosec G306 -- Need readable files require.NoError(t, os.WriteFile(rubyInFile, []byte(base64.StdEncoding.EncodeToString(b)), 0644)) ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) diff --git a/cross_language_tests/challenge_cross_test.go b/cross_language_tests/challenge_cross_test.go index 8f96cfd..5acc7ef 100644 --- a/cross_language_tests/challenge_cross_test.go +++ b/cross_language_tests/challenge_cross_test.go @@ -225,7 +225,6 @@ func TestChallenge_GoGenerate_RubyRespond(t *testing.T) { } } -// #nosec G306 -- Need readable files func rubyChallengeExec(rubyCmd, dir string, inputData rubyChallengeCmd) ([]byte, error) { testCaseBytes, err := msgpack.Marshal(inputData) if err != nil { @@ -236,7 +235,9 @@ func rubyChallengeExec(rubyCmd, dir string, inputData rubyChallengeCmd) ([]byte, inFilePath := filepath.Join(dir, "in") - if err := os.WriteFile(inFilePath, testCaseBytesBase64, 0644); err != nil { + //#nosec G306 -- Need readable files + err = os.WriteFile(inFilePath, testCaseBytesBase64, 0644) + if err != nil { return nil, err } diff --git a/cross_language_tests/rsa_cross_test.go b/cross_language_tests/rsa_cross_test.go index c85b701..7bd8591 100644 --- a/cross_language_tests/rsa_cross_test.go +++ b/cross_language_tests/rsa_cross_test.go @@ -37,7 +37,6 @@ func TestRsaRuby(t *testing.T) { {Plaintext: mkrand(t, 128)}, } - //#nosec G306 -- Need readable files for _, tt := range tests { tt := tt t.Run("", func(t *testing.T) { @@ -72,6 +71,7 @@ func TestRsaRuby(t *testing.T) { b, err := msgpack.Marshal(tt) require.NoError(t, err) + //#nosec G306 -- Need readable files require.NoError(t, os.WriteFile(testfile, []byte(base64.StdEncoding.EncodeToString(b)), 0644)) cmd := exec.CommandContext(ctx, "ruby", rsaRB, "decrypt", testfile, path.Join(dir, "ruby-decrypt")) @@ -98,6 +98,7 @@ func TestRsaRuby(t *testing.T) { b, err := msgpack.Marshal(tt) require.NoError(t, err) + //#nosec G306 -- Need readable files require.NoError(t, os.WriteFile(testfile, []byte(base64.StdEncoding.EncodeToString(b)), 0644)) cmd := exec.CommandContext(ctx, "ruby", rsaRB, "encrypt", testfile, path.Join(dir, "ruby-encrypt")) @@ -130,6 +131,7 @@ func TestRsaRuby(t *testing.T) { b, err := msgpack.Marshal(tt) require.NoError(t, err) + //#nosec G306 -- Need readable files require.NoError(t, os.WriteFile(testfile, []byte(base64.StdEncoding.EncodeToString(b)), 0644)) cmd := exec.CommandContext(ctx, "ruby", rsaRB, "verify", testfile, path.Join(dir, "ruby-verify")) @@ -157,6 +159,7 @@ func TestRsaRuby(t *testing.T) { b, err := msgpack.Marshal(tt) require.NoError(t, err) + //#nosec G306 -- Need readable files require.NoError(t, os.WriteFile(testfile, []byte(base64.StdEncoding.EncodeToString(b)), 0644)) cmd := exec.CommandContext(ctx, "ruby", rsaRB, "sign", testfile, path.Join(dir, "ruby-signed"))