From 8e24ee42170f821bc0e64301b0bfc0a489a79755 Mon Sep 17 00:00:00 2001 From: Fred Carle Date: Fri, 15 Nov 2024 14:58:22 -0500 Subject: [PATCH] fix(i): Remove flakyness of AES decrypt test (#3241) ## Relevant issue(s) Resolves #3240 ## Description This PR fixes a flaky test where the modification of the cypher text was supposed to cause it to fail decryption. The modification turned out to sometime be the same as the actual cypher text. --- crypto/aes_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crypto/aes_test.go b/crypto/aes_test.go index 7218ca24b2..7d3375c236 100644 --- a/crypto/aes_test.go +++ b/crypto/aes_test.go @@ -149,9 +149,10 @@ func TestDecryptAES(t *testing.T) { errorContains: "message authentication failed", }, { - name: "Tampered ciphertext", - nonce: validNonce, - cipherText: append([]byte{0}, validCiphertext[AESNonceSize+1:]...), + name: "Tampered ciphertext", + nonce: validNonce, + // Flip a byte in the ciphertext to corrupt it. + cipherText: append([]byte{^validCiphertext[AESNonceSize]}, validCiphertext[AESNonceSize+1:]...), key: validKey, additionalData: validAAD, expectError: true,