- 
                Notifications
    You must be signed in to change notification settings 
- Fork 637
Closed
Labels
bugThis issue is a bug.This issue is a bug.p2This is a standard priority issueThis is a standard priority issueresponse-requestedWaiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.
Description
Checkboxes for prior research
- I've gone through Developer Guide and API reference
- I've checked AWS Forums and StackOverflow.
- I've searched for previous similar issues and didn't find any solution.
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
- Create a secret in Account A, Region us-west-2
- Create an IAM policy allowing Acount B to access to the secret in Account A
- 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.This issue is a bug.p2This is a standard priority issueThis is a standard priority issueresponse-requestedWaiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.