Files
floci/docs
Priamo Germosen a5379cd5d8 fix(secretsmanager): refuse a rotation function in another Region with InvalidParameterException (#4873)
Follow-up from the review of #4768.

A well-formed full function ARN in another Region passed the reference check,
then Lambda's lookup refused it with InvalidParameterValueException ("Region
'us-west-2' in ARN does not match request region 'us-east-1'") and RotateSecret
rethrew that unchanged. InvalidParameterValueException is not an error
RotateSecret declares, so an SDK client could not type the refusal.

The Region is now checked with the rest of the reference, before the caller's
lambda:InvokeFunction check, and refused with InvalidParameterException and
Lambda's reason in the message, like a reference Lambda cannot parse. Checked
only at the lookup, it came after the caller check, so under IAM enforcement a
caller not allowed to invoke that ARN got AccessDeniedException for a reference
that is invalid whoever sends it. Any other 400 Lambda gives at the lookup is
mapped the same way, through one helper; a missing function is still
AccessDeniedException and anything else still passes through. The secret is
left as it was.

Neither the Secrets Manager User Guide nor the API Reference says which error a
function in another Region gets, or that the function must share the secret's
Region. InvalidParameterException is the one RotateSecret declares for an
invalid parameter value.

An integration test runs RotateSecret against the real Lambda service with a
us-west-2 function ARN from us-east-1; it fails on main with
InvalidParameterValueException. Unit tests check the Region refusal comes
before the caller check and keeps a previously configured function, and that a
Lambda 400 at the lookup maps too. docs/services/secrets-manager.md describes it.
2026-10-02 07:45:59 -05:00
..
2026-03-15 17:43:56 -05:00