Skip to content

GetSecretValueCommand does not respect ARN Region #7278

@deesejohn

Description

@deesejohn

Checkboxes for prior research

Describe the bug

GetSecretValueCommand does not respect the region from the ARN provided to the SecretId parameter. It appears to only respect the client's set region.

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/[email protected]

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

lambda runtime nodejs20.x

Reproduction Steps

  1. Create a secret in Account A, Region us-west-2
  2. Create an IAM policy allowing Acount B to access to the secret in Account A
  3. Create a lambda in Account B, Region us-east-1 that retrieves the secret from Account A
// The following Example fails
const secretsClient = new SecretsManagerClient({
  region: 'us-east-1',
});
const response = secretsClient.send(
  new GetSecretValueCommand({
    SecretId: `arn:aws:secretsmanager:us-west-2:${ACCOUNT_ID}:secret:/example`
  }),
);

// The following Example works
const secretsClient = new SecretsManagerClient({
  region: 'us-west-2',
});
const response = secretsClient.send(
  new GetSecretValueCommand({
    SecretId: `arn:aws:secretsmanager:us-west-2:${ACCOUNT_ID}:secret:/example`
  }),
);

Observed Behavior

AccessDeniedException: User: arn:aws:sts::$ACCOUNT_ID:assumed-role/example is not authorized to perform: secretsmanager:GetSecretValue on resource: arn:aws:secretsmanager:us-west-2:$ACCOUNT_ID:secret:/example because no resource-based policy allows the secretsmanager:GetSecretValue action

Expected Behavior

The secret value is returned

Possible Solution

No response

Additional Information/Context

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p2This is a standard priority issueresponse-requestedWaiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions