Compare commits

..
7 changed files with 168 additions and 173 deletions

No files matched your search

+1 -3
View File
@@ -2,8 +2,6 @@ module github.com/hashicorp/boundary-plugin-aws
go 1.20
replace github.com/hashicorp/boundary/sdk => github.com/hashicorp/boundary/sdk v0.0.35-0.20230705165757-c7e98a6f1782
require (
github.com/aws/aws-sdk-go v1.44.80
github.com/aws/aws-sdk-go-v2 v1.17.7
@@ -12,7 +10,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/s3 v1.31.1
github.com/google/go-cmp v0.5.9
github.com/google/uuid v1.3.0
github.com/hashicorp/boundary/sdk v0.0.35
github.com/hashicorp/boundary/sdk v0.0.33
github.com/hashicorp/go-secure-stdlib/awsutil v0.1.6
github.com/hashicorp/terraform-json v0.14.0
github.com/mitchellh/mapstructure v1.5.0
+2 -2
View File
@@ -69,8 +69,8 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hashicorp/boundary/sdk v0.0.35-0.20230705165757-c7e98a6f1782 h1:MuBxNJCn7At92jVlc17GMOghSkTy+33/DOBh/JvaVxU=
github.com/hashicorp/boundary/sdk v0.0.35-0.20230705165757-c7e98a6f1782/go.mod h1:jn9j5mM8v2pOk8aLeJNIszdm7WBf4gRSP68iy8Iu5Q0=
github.com/hashicorp/boundary/sdk v0.0.33 h1:kHaVZ3b9j1QvYlG+vhAgrbXh8/+Rq2qlUIs8fKMQH7k=
github.com/hashicorp/boundary/sdk v0.0.33/go.mod h1:jn9j5mM8v2pOk8aLeJNIszdm7WBf4gRSP68iy8Iu5Q0=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
+9
View File
@@ -5,6 +5,7 @@ package credential
import (
"fmt"
"regexp"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/hashicorp/boundary-plugin-aws/internal/errors"
@@ -22,6 +23,8 @@ type CredentialAttributes struct {
DisableCredentialRotation bool
}
var accessKeyRegex = regexp.MustCompile(`^[\w]+$`)
// GetCredentialsConfig parses values out of a protobuf struct input and returns a
// CredentialsConfig used for configuring an AWS session. An error is returned if
// any of the following fields are missing from the protobuf struct input or have
@@ -34,12 +37,18 @@ func GetCredentialsConfig(in *structpb.Struct, region string) (*awsutil.Credenti
accessKey, err := values.GetStringValue(in, ConstAccessKeyId, true)
if err != nil {
badFields[fmt.Sprintf("secrets.%s", ConstAccessKeyId)] = err.Error()
} else if len(accessKey) < 16 || len(accessKey) > 128 {
badFields[fmt.Sprintf("secrets.%s", ConstAccessKeyId)] = "value must be between 16 and 128 characters"
} else if !accessKeyRegex.MatchString(accessKey) {
badFields[fmt.Sprintf("secrets.%s", ConstAccessKeyId)] = "value must only contain characters matching [\\w]+"
}
delete(unknownFields, ConstAccessKeyId)
secretKey, err := values.GetStringValue(in, ConstSecretAccessKey, true)
if err != nil {
badFields[fmt.Sprintf("secrets.%s", ConstSecretAccessKey)] = err.Error()
} else if len(secretKey) != 40 {
badFields[fmt.Sprintf("secrets.%s", ConstSecretAccessKey)] = "value must be 40 characters"
}
delete(unknownFields, ConstSecretAccessKey)
+33 -7
View File
@@ -120,29 +120,55 @@ func TestGetCredentialsConfig(t *testing.T) {
expectedErrContains: "secrets.bar: unrecognized field, secrets.foo: unrecognized field",
},
{
name: "valid ignore creds_last_rotated_time",
name: "keys not right length",
in: map[string]any{
ConstAccessKeyId: "foobar",
ConstSecretAccessKey: "bazqux",
ConstCredsLastRotatedTime: "2006-01-02T15:04:05+07:00",
},
region: "us-west-2",
expectedErrContains: "secrets.access_key_id: value must be between 16 and 128 characters, secrets.secret_access_key: value must be 40 characters",
},
{
name: "key contains invalid chars",
in: map[string]any{
ConstAccessKeyId: "foobarbazbuzquintile-",
ConstSecretAccessKey: "bazqux-not-thinking-of-40-chars-for-this",
ConstCredsLastRotatedTime: "2006-01-02T15:04:05+07:00",
},
region: "us-west-2",
expectedErrContains: "secrets.access_key_id: value must only contain characters matching [\\w]+",
},
{
name: "getstring error doesn't trigger char len error",
in: map[string]any{},
region: "us-west-2",
expectedErrContains: "[secrets.access_key_id: missing required value \"access_key_id\", secrets.secret_access_key: missing required value \"secret_access_key\"]",
},
{
name: "valid ignore creds_last_rotated_time",
in: map[string]any{
ConstAccessKeyId: "foobarbazbuzquintile",
ConstSecretAccessKey: "bazqux-not-thinking-of-40-chars-for-this",
ConstCredsLastRotatedTime: "2006-01-02T15:04:05+07:00",
},
region: "us-west-2",
expected: &awsutil.CredentialsConfig{
AccessKey: "foobar",
SecretKey: "bazqux",
AccessKey: "foobarbazbuzquintile",
SecretKey: "bazqux-not-thinking-of-40-chars-for-this",
Region: "us-west-2",
},
},
{
name: "good",
in: map[string]any{
ConstAccessKeyId: "foobar",
ConstSecretAccessKey: "bazqux",
ConstAccessKeyId: "foobarbazbuzquintile",
ConstSecretAccessKey: "bazqux-not-thinking-of-40-chars-for-this",
},
region: "us-west-2",
expected: &awsutil.CredentialsConfig{
AccessKey: "foobar",
SecretKey: "bazqux",
AccessKey: "foobarbazbuzquintile",
SecretKey: "bazqux-not-thinking-of-40-chars-for-this",
Region: "us-west-2",
},
},
+70 -70
View File
@@ -92,8 +92,8 @@ func TestPluginOnCreateCatalogErr(t *testing.T) {
Catalog: &hostcatalogs.HostCatalog{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
}},
Attrs: &hostcatalogs.HostCatalog_Attributes{
Attributes: &structpb.Struct{
@@ -113,8 +113,8 @@ func TestPluginOnCreateCatalogErr(t *testing.T) {
Catalog: &hostcatalogs.HostCatalog{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
}},
Attrs: &hostcatalogs.HostCatalog_Attributes{
Attributes: &structpb.Struct{
@@ -139,8 +139,8 @@ func TestPluginOnCreateCatalogErr(t *testing.T) {
Catalog: &hostcatalogs.HostCatalog{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
}},
Attrs: &hostcatalogs.HostCatalog_Attributes{
Attributes: &structpb.Struct{
@@ -169,8 +169,8 @@ func TestPluginOnCreateCatalogErr(t *testing.T) {
Catalog: &hostcatalogs.HostCatalog{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
}},
Attrs: &hostcatalogs.HostCatalog_Attributes{
Attributes: &structpb.Struct{
@@ -280,8 +280,8 @@ func TestPluginOnUpdateCatalogErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -311,8 +311,8 @@ func TestPluginOnUpdateCatalogErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -337,8 +337,8 @@ func TestPluginOnUpdateCatalogErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -353,8 +353,8 @@ func TestPluginOnUpdateCatalogErr(t *testing.T) {
NewCatalog: &hostcatalogs.HostCatalog{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("onetwo"),
credential.ConstSecretAccessKey: structpb.NewStringValue("threefour"),
credential.ConstAccessKeyId: structpb.NewStringValue("00000000000000onetwo"),
credential.ConstSecretAccessKey: structpb.NewStringValue("0000000000000000000000000000000threefour"),
},
},
Attrs: &hostcatalogs.HostCatalog_Attributes{
@@ -369,8 +369,8 @@ func TestPluginOnUpdateCatalogErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -403,8 +403,8 @@ func TestPluginOnUpdateCatalogErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
},
},
},
@@ -462,8 +462,8 @@ func TestPluginOnDeleteCatalogErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -492,8 +492,8 @@ func TestPluginOnDeleteCatalogErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -597,8 +597,8 @@ func TestPluginOnCreateSetErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -627,8 +627,8 @@ func TestPluginOnCreateSetErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -652,8 +652,8 @@ func TestPluginOnCreateSetErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -678,8 +678,8 @@ func TestPluginOnCreateSetErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -713,8 +713,8 @@ func TestPluginOnCreateSetErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -758,8 +758,8 @@ func TestPluginOnCreateSetErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -804,8 +804,8 @@ func TestPluginOnCreateSetErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -849,8 +849,8 @@ func TestPluginOnCreateSetErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -966,8 +966,8 @@ func TestPluginOnUpdateSetErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -996,8 +996,8 @@ func TestPluginOnUpdateSetErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -1021,8 +1021,8 @@ func TestPluginOnUpdateSetErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -1047,8 +1047,8 @@ func TestPluginOnUpdateSetErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -1082,8 +1082,8 @@ func TestPluginOnUpdateSetErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -1127,8 +1127,8 @@ func TestPluginOnUpdateSetErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -1173,8 +1173,8 @@ func TestPluginOnUpdateSetErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -1290,8 +1290,8 @@ func TestPluginListHostsErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -1320,8 +1320,8 @@ func TestPluginListHostsErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -1345,8 +1345,8 @@ func TestPluginListHostsErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -1371,8 +1371,8 @@ func TestPluginListHostsErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -1401,8 +1401,8 @@ func TestPluginListHostsErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -1439,8 +1439,8 @@ func TestPluginListHostsErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -1487,8 +1487,8 @@ func TestPluginListHostsErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -1536,8 +1536,8 @@ func TestPluginListHostsErr(t *testing.T) {
Persisted: &pb.HostCatalogPersisted{
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
+1 -39
View File
@@ -9,7 +9,6 @@ import (
"context"
"crypto/sha256"
"encoding/base64"
"fmt"
"io"
"os"
"path"
@@ -18,7 +17,6 @@ import (
"github.com/aws/aws-sdk-go-v2/aws/retry"
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/aws/aws-sdk-go-v2/service/s3/types"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/google/uuid"
cred "github.com/hashicorp/boundary-plugin-aws/internal/credential"
"github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/storagebuckets"
@@ -716,41 +714,5 @@ func parseAWSErrCode(msg string, err error) error {
if retryErr.IsErrorThrottle(err).Bool() {
errCode = codes.Unavailable
}
st := status.New(errCode, fmt.Sprintf("%s: %s", msg, err))
if aerr, ok := err.(awserr.Error); ok {
detail := &pb.ErrorDetail{
Status: 500,
Code: aerr.Code(),
Message: aerr.Message(),
}
// aws error codes are strings that are more granular than status codes
// https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html
switch aerr.Code() {
case "AccessDenied":
// generic 403 response, who knows, credentials were invalidated, etc
detail.Status = 403
errCode = codes.Unauthenticated
case "InvalidSecurity":
// these specific credentials aren't valid
fallthrough
case "InvalidAccessKeyId":
// a specific case for an access key being revoked. this is probably
// the one we want to watch out for
fallthrough
case "UnauthorizedAccess":
// standard 401 response, client is no longer authorized and may
// need new credentials
detail.Status = 401
errCode = codes.Unauthenticated
default:
// we didn't get a code we were expecting, just fallback to previous
// logic. if we need to parse more codes in the future, we can.
}
var sterr error
if st, sterr = st.WithDetails(detail); sterr != nil {
panic(fmt.Sprintf("Unexpected error while attaching AWS error metadata: %v", sterr))
}
}
return st.Err()
return status.Errorf(errCode, "%s: %s", msg, err)
}
+52 -52
View File
@@ -36,8 +36,8 @@ func TestStoragePlugin_OnCreateStorageBucket(t *testing.T) {
BucketName: "foo",
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
}},
Attributes: &structpb.Struct{
Fields: map[string]*structpb.Value{
@@ -126,8 +126,8 @@ func TestStoragePlugin_OnCreateStorageBucket(t *testing.T) {
BucketName: "foo",
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
}},
Attributes: &structpb.Struct{
Fields: map[string]*structpb.Value{
@@ -158,8 +158,8 @@ func TestStoragePlugin_OnCreateStorageBucket(t *testing.T) {
BucketName: "foo",
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
}},
Attributes: &structpb.Struct{
Fields: map[string]*structpb.Value{
@@ -347,8 +347,8 @@ func TestStoragePlugin_OnUpdateStorageBucket(t *testing.T) {
Persisted: &storagebuckets.StorageBucketPersisted{
Data: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
},
},
},
@@ -428,8 +428,8 @@ func TestStoragePlugin_OnUpdateStorageBucket(t *testing.T) {
Persisted: &storagebuckets.StorageBucketPersisted{
Data: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -458,8 +458,8 @@ func TestStoragePlugin_OnUpdateStorageBucket(t *testing.T) {
Persisted: &storagebuckets.StorageBucketPersisted{
Data: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -483,8 +483,8 @@ func TestStoragePlugin_OnUpdateStorageBucket(t *testing.T) {
Persisted: &storagebuckets.StorageBucketPersisted{
Data: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -500,8 +500,8 @@ func TestStoragePlugin_OnUpdateStorageBucket(t *testing.T) {
BucketName: "foo",
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("onetwo"),
credential.ConstSecretAccessKey: structpb.NewStringValue("threefour"),
credential.ConstAccessKeyId: structpb.NewStringValue("00000000000000onetwo"),
credential.ConstSecretAccessKey: structpb.NewStringValue("0000000000000000000000000000000threefour"),
},
},
Attributes: &structpb.Struct{
@@ -514,8 +514,8 @@ func TestStoragePlugin_OnUpdateStorageBucket(t *testing.T) {
Persisted: &storagebuckets.StorageBucketPersisted{
Data: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -547,8 +547,8 @@ func TestStoragePlugin_OnUpdateStorageBucket(t *testing.T) {
Persisted: &storagebuckets.StorageBucketPersisted{
Data: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
},
},
},
@@ -671,8 +671,8 @@ func TestStoragePlugin_OnUpdateStorageBucket(t *testing.T) {
Persisted: &storagebuckets.StorageBucketPersisted{
Data: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
},
},
},
@@ -809,8 +809,8 @@ func TestStoragePlugin_OnDeleteStorageBucket(t *testing.T) {
BucketName: "foo",
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
}},
Attributes: &structpb.Struct{
Fields: map[string]*structpb.Value{
@@ -835,8 +835,8 @@ func TestStoragePlugin_OnDeleteStorageBucket(t *testing.T) {
Persisted: &storagebuckets.StorageBucketPersisted{
Data: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -863,8 +863,8 @@ func TestStoragePlugin_OnDeleteStorageBucket(t *testing.T) {
Persisted: &storagebuckets.StorageBucketPersisted{
Data: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -895,8 +895,8 @@ func TestStoragePlugin_OnDeleteStorageBucket(t *testing.T) {
Persisted: &storagebuckets.StorageBucketPersisted{
Data: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
credential.ConstCredsLastRotatedTime: structpb.NewStringValue("2006-01-02T15:04:05+07:00"),
},
},
@@ -942,8 +942,8 @@ func TestStoragePlugin_HeadObject(t *testing.T) {
BucketName: "foo",
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
}},
Attributes: &structpb.Struct{
Fields: map[string]*structpb.Value{
@@ -1142,8 +1142,8 @@ func TestStoragePlugin_ValidatePermissions(t *testing.T) {
BucketName: "foo",
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
}},
Attributes: &structpb.Struct{
Fields: map[string]*structpb.Value{
@@ -1385,8 +1385,8 @@ func TestStoragePlugin_GetObject(t *testing.T) {
BucketName: "foo",
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
}},
Attributes: &structpb.Struct{
Fields: map[string]*structpb.Value{
@@ -1618,8 +1618,8 @@ func TestStoragePlugin_PutObject(t *testing.T) {
BucketName: "external-obj-store",
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
},
},
Attributes: &structpb.Struct{
@@ -1689,8 +1689,8 @@ func TestStoragePlugin_PutObject(t *testing.T) {
BucketName: "external-obj-store",
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
},
},
},
@@ -1706,8 +1706,8 @@ func TestStoragePlugin_PutObject(t *testing.T) {
BucketName: "external-obj-store",
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
},
},
Attributes: &structpb.Struct{
@@ -1728,8 +1728,8 @@ func TestStoragePlugin_PutObject(t *testing.T) {
BucketName: "external-obj-store",
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
},
},
Attributes: &structpb.Struct{
@@ -1751,8 +1751,8 @@ func TestStoragePlugin_PutObject(t *testing.T) {
BucketName: "external-obj-store",
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
},
},
Attributes: &structpb.Struct{
@@ -1774,8 +1774,8 @@ func TestStoragePlugin_PutObject(t *testing.T) {
BucketName: "external-obj-store",
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
},
},
Attributes: &structpb.Struct{
@@ -1797,8 +1797,8 @@ func TestStoragePlugin_PutObject(t *testing.T) {
BucketName: "external-obj-store",
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
},
},
Attributes: &structpb.Struct{
@@ -1818,8 +1818,8 @@ func TestStoragePlugin_PutObject(t *testing.T) {
BucketName: "external-obj-store",
Secrets: &structpb.Struct{
Fields: map[string]*structpb.Value{
credential.ConstAccessKeyId: structpb.NewStringValue("foobar"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux"),
credential.ConstAccessKeyId: structpb.NewStringValue("foobarbazbuzquintile"),
credential.ConstSecretAccessKey: structpb.NewStringValue("bazqux-not-thinking-of-40-chars-for-this"),
},
},
Attributes: &structpb.Struct{