@@ -276,19 +276,19 @@ func AssumeIamRole(
276276}
277277
278278// GetAWSCallerIdentity gets the caller identity from AWS
279- func GetAWSCallerIdentity (ctx context.Context , cfg aws.Config ) (* sts.GetCallerIdentityOutput , error ) {
280- stsClient := sts .NewFromConfig (cfg )
279+ func GetAWSCallerIdentity (ctx context.Context , cfg * aws.Config ) (* sts.GetCallerIdentityOutput , error ) {
280+ stsClient := sts .NewFromConfig (* cfg )
281281 return stsClient .GetCallerIdentity (ctx , & sts.GetCallerIdentityInput {})
282282}
283283
284284// ValidateAwsConfig validates that the AWS config has valid credentials
285- func ValidateAwsConfig (ctx context.Context , cfg aws.Config ) error {
285+ func ValidateAwsConfig (ctx context.Context , cfg * aws.Config ) error {
286286 _ , err := GetAWSCallerIdentity (ctx , cfg )
287287 return err
288288}
289289
290290// GetAWSPartition gets the AWS partition from the caller identity
291- func GetAWSPartition (ctx context.Context , cfg aws.Config ) (string , error ) {
291+ func GetAWSPartition (ctx context.Context , cfg * aws.Config ) (string , error ) {
292292 result , err := GetAWSCallerIdentity (ctx , cfg )
293293 if err != nil {
294294 return "" , err
@@ -310,8 +310,8 @@ func GetAWSPartition(ctx context.Context, cfg aws.Config) (string, error) {
310310}
311311
312312// GetAWSAccountAlias gets the AWS account alias
313- func GetAWSAccountAlias (ctx context.Context , cfg aws.Config ) (string , error ) {
314- iamClient := iam .NewFromConfig (cfg )
313+ func GetAWSAccountAlias (ctx context.Context , cfg * aws.Config ) (string , error ) {
314+ iamClient := iam .NewFromConfig (* cfg )
315315
316316 result , err := iamClient .ListAccountAliases (ctx , & iam.ListAccountAliasesInput {})
317317 if err != nil {
@@ -326,7 +326,7 @@ func GetAWSAccountAlias(ctx context.Context, cfg aws.Config) (string, error) {
326326}
327327
328328// GetAWSAccountID gets the AWS account ID from the caller identity
329- func GetAWSAccountID (ctx context.Context , cfg aws.Config ) (string , error ) {
329+ func GetAWSAccountID (ctx context.Context , cfg * aws.Config ) (string , error ) {
330330 result , err := GetAWSCallerIdentity (ctx , cfg )
331331 if err != nil {
332332 return "" , err
@@ -336,7 +336,7 @@ func GetAWSAccountID(ctx context.Context, cfg aws.Config) (string, error) {
336336}
337337
338338// GetAWSIdentityArn gets the AWS identity ARN from the caller identity
339- func GetAWSIdentityArn (ctx context.Context , cfg aws.Config ) (string , error ) {
339+ func GetAWSIdentityArn (ctx context.Context , cfg * aws.Config ) (string , error ) {
340340 result , err := GetAWSCallerIdentity (ctx , cfg )
341341 if err != nil {
342342 return "" , err
@@ -346,7 +346,7 @@ func GetAWSIdentityArn(ctx context.Context, cfg aws.Config) (string, error) {
346346}
347347
348348// GetAWSUserID gets the AWS user ID from the caller identity
349- func GetAWSUserID (ctx context.Context , cfg aws.Config ) (string , error ) {
349+ func GetAWSUserID (ctx context.Context , cfg * aws.Config ) (string , error ) {
350350 result , err := GetAWSCallerIdentity (ctx , cfg )
351351 if err != nil {
352352 return "" , err
@@ -369,6 +369,7 @@ func ValidatePublicAccessBlock(output *s3.GetPublicAccessBlockOutput) (bool, err
369369 aws .ToBool (config .RestrictPublicBuckets ), nil
370370}
371371
372+ //nolint:gocritic // hugeParam: intentionally pass by value to avoid recursive credential resolution
372373func getWebIdentityCredentialsFromIAMRoleOptions (cfg aws.Config , iamRoleOptions options.IAMRoleOptions ) aws.CredentialsProviderFunc {
373374 roleSessionName := iamRoleOptions .AssumeRoleSessionName
374375 if roleSessionName == "" {
@@ -411,6 +412,7 @@ func getWebIdentityCredentialsFromIAMRoleOptions(cfg aws.Config, iamRoleOptions
411412 }
412413}
413414
415+ //nolint:gocritic // hugeParam: intentionally pass by value to avoid recursive credential resolution
414416func getSTSCredentialsFromIAMRoleOptions (cfg aws.Config , iamRoleOptions options.IAMRoleOptions , externalID string ) aws.CredentialsProviderFunc {
415417 return func (ctx context.Context ) (aws.Credentials , error ) {
416418 stsClient := sts .NewFromConfig (cfg )
0 commit comments