Skip to content

Commit

Permalink
lintage
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Pickett committed Apr 12, 2024
1 parent 404eea4 commit fe593d5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions cross_language_tests/aes_cross_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestAesRuby(t *testing.T) {
{AuthData: mkrand(t, 32), Plaintext: mkrand(t, 1024)},
}

//#nosec G306 -- Need readable files
// #nosec G306 -- Need readable files
for _, tt := range tests {
tt := tt
t.Run("", func(t *testing.T) {
Expand All @@ -60,7 +60,7 @@ func TestAesRuby(t *testing.T) {

b, err := msgpack.Marshal(tt)
require.NoError(t, err)
//#nosec G306 -- Need readable files
// #nosec G306 -- Need readable files
require.NoError(t, os.WriteFile(testfile, []byte(base64.StdEncoding.EncodeToString(b)), 0644))
})

Expand Down
12 changes: 6 additions & 6 deletions cross_language_tests/boxer_cross_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestBoxerRuby(t *testing.T) {
}

// Ruby Decrypt Tests
//#nosec G306 -- Need readable files
// #nosec G306 -- Need readable files
for _, message := range testMessages {
message := message

Expand All @@ -93,7 +93,7 @@ func TestBoxerRuby(t *testing.T) {

b, err := msgpack.Marshal(rubyCommand)
require.NoError(t, err)
//#nosec G306 -- Need readable files
// #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)
Expand Down Expand Up @@ -161,7 +161,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
// #nosec G306 -- Need readable files
require.NoError(t, os.WriteFile(pngFile, png.Bytes(), 0644))

tests := []boxerCrossTestCase{
Expand Down Expand Up @@ -202,13 +202,13 @@ func TestBoxerRuby(t *testing.T) {
//
b, err := msgpack.Marshal(tt)
require.NoError(t, err)
//#nosec G306 -- Need readable files
// #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)
defer cancel()

//#nosec G204 -- No taint on hardcoded input
// #nosec G204 -- No taint on hardcoded input
cmd := exec.CommandContext(ctx, "ruby", boxerRB, tt.cmd, testfile, rubyout)
out, err := cmd.CombinedOutput()

Expand Down Expand Up @@ -384,7 +384,7 @@ func TestBoxerMaxSize(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()

//#nosec G204 -- No taint on hardcoded input
// #nosec G204 -- No taint on hardcoded input
cmd := exec.CommandContext(ctx, "ruby", boxerRB, tt.cmd, testfile, rubyout)
out, err := cmd.CombinedOutput()

Expand Down
2 changes: 1 addition & 1 deletion cross_language_tests/rsa_cross_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestRsaRuby(t *testing.T) {
{Plaintext: mkrand(t, 128)},
}

//#nosec G306 -- Need readable files
// #nosec G306 -- Need readable files
for _, tt := range tests {
tt := tt
t.Run("", func(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions rsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"crypto"
"crypto/rand"
"crypto/rsa"
"crypto/sha1" //#nosec G505 -- Need compatibility
"crypto/sha1" // #nosec G505 -- Need compatibility
"crypto/sha256"
"crypto/x509"
"encoding/pem"
Expand All @@ -18,7 +18,7 @@ func RsaEncrypt(key *rsa.PublicKey, secretMessage []byte) ([]byte, error) {
return nil, errors.New("Cannot encrypt with a nil key")
}

//#nosec G401 -- Need compatibility
// #nosec G401 -- Need compatibility
return rsa.EncryptOAEP(sha1.New(), rand.Reader, key, secretMessage, nil)
}

Expand All @@ -27,7 +27,7 @@ func RsaDecrypt(key *rsa.PrivateKey, ciphertext []byte) ([]byte, error) {
return nil, errors.New("Cannot decrypt with a nil key")
}

//#nosec G401 -- Need compatibility
// #nosec G401 -- Need compatibility
return rsa.DecryptOAEP(sha1.New(), rand.Reader, key, ciphertext, nil)
}

Expand Down

0 comments on commit fe593d5

Please sign in to comment.