mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
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.