Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ name: PR CI
on:
pull_request:

permissions:
id-token: write
contents: read

jobs:
pr-ci-go-v3-test:
uses: ./.github/workflows/ci_test_go_v3.yml
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
branches:
- main

permissions:
id-token: write
contents: read

jobs:
push-ci-go-v3-test:
uses: ./.github/workflows/ci_test_go_v3.yml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: not-grep
uses: mattsb42-meta/not-grep@1.0.0
uses: mattsb42-meta/not-grep@1.0.1
17 changes: 9 additions & 8 deletions v3/testvectors/compatibility_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func TestKmsV1toV4_CBC(t *testing.T) {
kmsKeyAlias := LoadAwsKmsAlias()

cekAlg := "aes_cbc"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/V1toV4_CBC.txt"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/V1toV4_CBC_" + uniqueSuffix() + ".txt"
region := "us-west-2"
plaintext := "This is a test.\n"

Expand Down Expand Up @@ -183,7 +183,7 @@ func TestKmsV1toV4_GCM(t *testing.T) {
kmsKeyAlias := LoadAwsKmsAlias()

cekAlg := "aes_gcm"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/V1toV4_GCM.txt"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/V1toV4_GCM_" + uniqueSuffix() + ".txt"
region := "us-west-2"
plaintext := "This is a test.\n"

Expand Down Expand Up @@ -252,7 +252,7 @@ func TestKmsContextV2toV4_GCM(t *testing.T) {
kmsKeyAlias := LoadAwsKmsAlias()

cekAlg := "aes_gcm"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/V2toV4_GCM.txt"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/V2toV4_GCM_" + uniqueSuffix() + ".txt"
region := "us-west-2"
plaintext := "This is a test.\n"

Expand Down Expand Up @@ -320,7 +320,7 @@ func TestKmsContextV4toV2_GCM(t *testing.T) {
kmsKeyAlias := LoadAwsKmsAlias()

cekAlg := "aes_gcm"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/V4toV2_GCM.txt"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/V4toV2_GCM_" + uniqueSuffix() + ".txt"
region := "us-west-2"
plaintext := "This is a test.\n"

Expand Down Expand Up @@ -388,7 +388,7 @@ func TestInstructionFileV2toV4(t *testing.T) {
kmsKeyAlias := LoadAwsKmsAlias()

cekAlg := "aes_cbc"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/inst_file_test.txt"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/inst_file_test_" + uniqueSuffix() + ".txt"
region := "us-west-2"
plaintext := "This is a test.\n"

Expand Down Expand Up @@ -461,7 +461,7 @@ func TestNegativeKeyringOption(t *testing.T) {
kmsKeyAlias := LoadAwsKmsAlias()

cekAlg := "aes_cbc"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/NegativeV1toV4_CBC.txt"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/NegativeV1toV4_CBC_" + uniqueSuffix() + ".txt"
region := "us-west-2"
plaintext := "This is a test.\n"

Expand Down Expand Up @@ -520,9 +520,10 @@ func TestEnableLegacyDecryptBothFormats(t *testing.T) {
kmsKeyAlias := LoadAwsKmsAlias()

cekAlgCbc := "aes_cbc"
keyCbc := "crypto_tests/" + cekAlgCbc + "/v4/language_Go/BothFormats_CBC.txt"
suffix := uniqueSuffix()
keyCbc := "crypto_tests/" + cekAlgCbc + "/v4/language_Go/BothFormats_CBC_" + suffix + ".txt"
cekAlgGcm := "aes_gcm"
keyGcm := "crypto_tests/" + cekAlgGcm + "/v4/language_Go/BothFormats_GCM.txt"
keyGcm := "crypto_tests/" + cekAlgGcm + "/v4/language_Go/BothFormats_GCM_" + suffix + ".txt"
region := "us-west-2"
plaintext := "This is a test.\n"

Expand Down
20 changes: 14 additions & 6 deletions v3/testvectors/s3_integ_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ package testvectors
import (
"bytes"
"context"
"crypto/rand"
"encoding/hex"
"fmt"
"github.com/aws/amazon-s3-encryption-client-go/v3/algorithms"
"github.com/aws/amazon-s3-encryption-client-go/v3/client"
Expand All @@ -22,6 +24,12 @@ import (
"time"
)

func uniqueSuffix() string {
b := make([]byte, 8)
rand.Read(b)
return hex.EncodeToString(b)
}

const version = "v3"

func getAliasArn(shortAlias string, region string, accountId string) string {
Expand Down Expand Up @@ -404,7 +412,7 @@ func TestInteg_DeleteObjects_DeletesObjects(t *testing.T) {
var bucket = LoadBucket()
var region = LoadRegion()
var accountId = LoadAwsAccountId()
var baseKey = "delete-objects-test-" + time.Now().Format("20060102-150405")
var baseKey = "delete-objects-test-" + uniqueSuffix()
var key1 = baseKey + "-object1"
var key2 = baseKey + "-object2"
var key3 = baseKey + "-object3"
Expand Down Expand Up @@ -554,7 +562,7 @@ func TestInteg_DeleteObject_DeletesObjectAndInstructionFile(t *testing.T) {
var bucket = LoadBucket()
var region = LoadRegion()
var accountId = LoadAwsAccountId()
var key = "delete-object-test-" + time.Now().Format("20060102-150405")
var key = "delete-object-test-" + uniqueSuffix()
var plaintext = "Hello, S3 Encryption Client DeleteObject test!"

ctx := context.Background()
Expand Down Expand Up @@ -1243,7 +1251,7 @@ func TestInteg_GetObject_BasicDecryption(t *testing.T) {
var bucket = LoadBucket()
var region = LoadRegion()
var accountId = LoadAwsAccountId()
var key = "basic-getobject-test-" + time.Now().Format("20060102-150405")
var key = "basic-getobject-test-" + uniqueSuffix()
var plaintext = "Hello, S3 Encryption Client GetObject test!"

ctx := context.Background()
Expand Down Expand Up @@ -1339,7 +1347,7 @@ func TestInteg_PutObject_BasicEncryption(t *testing.T) {
var bucket = LoadBucket()
var region = LoadRegion()
var accountId = LoadAwsAccountId()
var key = "basic-putobject-test-" + time.Now().Format("20060102-150405")
var key = "basic-putobject-test-" + uniqueSuffix()
var plaintext = "Hello, S3 Encryption Client PutObject test!"

ctx := context.Background()
Expand Down Expand Up @@ -1562,7 +1570,7 @@ func TestInteg_AlgorithmSuiteMessageFormatCompatibility(t *testing.T) {
var bucket = LoadBucket()
var region = LoadRegion()
var accountId = LoadAwsAccountId()
var baseKey = "algorithm-suite-message-format-test-" + time.Now().Format("20060102-150405")
var baseKey = "algorithm-suite-message-format-test-" + uniqueSuffix()
var plaintext = "Hello, S3 Encryption Client Algorithm Suite Message Format test!"

ctx := context.Background()
Expand Down Expand Up @@ -1741,7 +1749,7 @@ func TestInteg_CommitmentPolicyBehavior(t *testing.T) {
var bucket = LoadBucket()
var region = LoadRegion()
var accountId = LoadAwsAccountId()
var baseKey = "commitment-policy-test-" + time.Now().Format("20060102-150405")
var baseKey = "commitment-policy-test-" + uniqueSuffix()
var plaintext = "Hello, S3 Encryption Client Commitment Policy test!"

ctx := context.Background()
Expand Down
17 changes: 9 additions & 8 deletions v4/testvectors/compatibility_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func TestKmsV1toV4_CBC(t *testing.T) {
kmsKeyAlias := LoadAwsKmsAlias()

cekAlg := "aes_cbc"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/V1toV4_CBC.txt"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/V1toV4_CBC_" + uniqueSuffix() + ".txt"
region := "us-west-2"
plaintext := "This is a test.\n"

Expand Down Expand Up @@ -183,7 +183,7 @@ func TestKmsV1toV4_GCM(t *testing.T) {
kmsKeyAlias := LoadAwsKmsAlias()

cekAlg := "aes_gcm"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/V1toV4_GCM.txt"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/V1toV4_GCM_" + uniqueSuffix() + ".txt"
region := "us-west-2"
plaintext := "This is a test.\n"

Expand Down Expand Up @@ -252,7 +252,7 @@ func TestKmsContextV2toV4_GCM(t *testing.T) {
kmsKeyAlias := LoadAwsKmsAlias()

cekAlg := "aes_gcm"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/V2toV4_GCM.txt"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/V2toV4_GCM_" + uniqueSuffix() + ".txt"
region := "us-west-2"
plaintext := "This is a test.\n"

Expand Down Expand Up @@ -320,7 +320,7 @@ func TestKmsContextV4toV2_GCM(t *testing.T) {
kmsKeyAlias := LoadAwsKmsAlias()

cekAlg := "aes_gcm"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/V4toV2_GCM.txt"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/V4toV2_GCM_" + uniqueSuffix() + ".txt"
region := "us-west-2"
plaintext := "This is a test.\n"

Expand Down Expand Up @@ -388,7 +388,7 @@ func TestInstructionFileV2toV4(t *testing.T) {
kmsKeyAlias := LoadAwsKmsAlias()

cekAlg := "aes_cbc"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/inst_file_test.txt"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/inst_file_test_" + uniqueSuffix() + ".txt"
region := "us-west-2"
plaintext := "This is a test.\n"

Expand Down Expand Up @@ -461,7 +461,7 @@ func TestNegativeKeyringOption(t *testing.T) {
kmsKeyAlias := LoadAwsKmsAlias()

cekAlg := "aes_cbc"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/NegativeV1toV4_CBC.txt"
key := "crypto_tests/" + cekAlg + "/v4/language_Go/NegativeV1toV4_CBC_" + uniqueSuffix() + ".txt"
region := "us-west-2"
plaintext := "This is a test.\n"

Expand Down Expand Up @@ -520,9 +520,10 @@ func TestEnableLegacyDecryptBothFormats(t *testing.T) {
kmsKeyAlias := LoadAwsKmsAlias()

cekAlgCbc := "aes_cbc"
keyCbc := "crypto_tests/" + cekAlgCbc + "/v4/language_Go/BothFormats_CBC.txt"
suffix := uniqueSuffix()
keyCbc := "crypto_tests/" + cekAlgCbc + "/v4/language_Go/BothFormats_CBC_" + suffix + ".txt"
cekAlgGcm := "aes_gcm"
keyGcm := "crypto_tests/" + cekAlgGcm + "/v4/language_Go/BothFormats_GCM.txt"
keyGcm := "crypto_tests/" + cekAlgGcm + "/v4/language_Go/BothFormats_GCM_" + suffix + ".txt"
region := "us-west-2"
plaintext := "This is a test.\n"

Expand Down
20 changes: 14 additions & 6 deletions v4/testvectors/s3_integ_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ package testvectors
import (
"bytes"
"context"
"crypto/rand"
"encoding/hex"
"fmt"
"github.com/aws/amazon-s3-encryption-client-go/v4/algorithms"
"github.com/aws/amazon-s3-encryption-client-go/v4/client"
Expand All @@ -22,6 +24,12 @@ import (
"time"
)

func uniqueSuffix() string {
b := make([]byte, 8)
rand.Read(b)
return hex.EncodeToString(b)
}

const version = "v4"

func getAliasArn(shortAlias string, region string, accountId string) string {
Expand Down Expand Up @@ -509,7 +517,7 @@ func TestInteg_DeleteObjects_DeletesObjects(t *testing.T) {
var bucket = LoadBucket()
var region = LoadRegion()
var accountId = LoadAwsAccountId()
var baseKey = "delete-objects-test-" + time.Now().Format("20060102-150405")
var baseKey = "delete-objects-test-" + uniqueSuffix()
var key1 = baseKey + "-object1"
var key2 = baseKey + "-object2"
var key3 = baseKey + "-object3"
Expand Down Expand Up @@ -659,7 +667,7 @@ func TestInteg_DeleteObject_DeletesObjectAndInstructionFile(t *testing.T) {
var bucket = LoadBucket()
var region = LoadRegion()
var accountId = LoadAwsAccountId()
var key = "delete-object-test-" + time.Now().Format("20060102-150405")
var key = "delete-object-test-" + uniqueSuffix()
var plaintext = "Hello, S3 Encryption Client DeleteObject test!"

ctx := context.Background()
Expand Down Expand Up @@ -1348,7 +1356,7 @@ func TestInteg_GetObject_BasicDecryption(t *testing.T) {
var bucket = LoadBucket()
var region = LoadRegion()
var accountId = LoadAwsAccountId()
var key = "basic-getobject-test-" + time.Now().Format("20060102-150405")
var key = "basic-getobject-test-" + uniqueSuffix()
var plaintext = "Hello, S3 Encryption Client GetObject test!"

ctx := context.Background()
Expand Down Expand Up @@ -1444,7 +1452,7 @@ func TestInteg_PutObject_BasicEncryption(t *testing.T) {
var bucket = LoadBucket()
var region = LoadRegion()
var accountId = LoadAwsAccountId()
var key = "basic-putobject-test-" + time.Now().Format("20060102-150405")
var key = "basic-putobject-test-" + uniqueSuffix()
var plaintext = "Hello, S3 Encryption Client PutObject test!"

ctx := context.Background()
Expand Down Expand Up @@ -1667,7 +1675,7 @@ func TestInteg_AlgorithmSuiteMessageFormatCompatibility(t *testing.T) {
var bucket = LoadBucket()
var region = LoadRegion()
var accountId = LoadAwsAccountId()
var baseKey = "algorithm-suite-message-format-test-" + time.Now().Format("20060102-150405")
var baseKey = "algorithm-suite-message-format-test-" + uniqueSuffix()
var plaintext = "Hello, S3 Encryption Client Algorithm Suite Message Format test!"

ctx := context.Background()
Expand Down Expand Up @@ -1858,7 +1866,7 @@ func TestInteg_CommitmentPolicyBehavior(t *testing.T) {
var bucket = LoadBucket()
var region = LoadRegion()
var accountId = LoadAwsAccountId()
var baseKey = "commitment-policy-test-" + time.Now().Format("20060102-150405")
var baseKey = "commitment-policy-test-" + uniqueSuffix()
var plaintext = "Hello, S3 Encryption Client Commitment Policy test!"

ctx := context.Background()
Expand Down
Loading