From fa0489301667e0910aba907d8bf9a1cc3d54cbea Mon Sep 17 00:00:00 2001 From: LuisFigueroaG Date: Mon, 5 Oct 2026 23:26:03 -0300 Subject: [PATCH] fix(data-classes): use user_uid for the Uid in Transfer Family PosixProfile --- .../data_classes/transfer_family_event.py | 2 +- .../test_transfer_family_event.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/aws_lambda_powertools/utilities/data_classes/transfer_family_event.py b/aws_lambda_powertools/utilities/data_classes/transfer_family_event.py index 5949c58a318..fbc501a0ea9 100644 --- a/aws_lambda_powertools/utilities/data_classes/transfer_family_event.py +++ b/aws_lambda_powertools/utilities/data_classes/transfer_family_event.py @@ -67,7 +67,7 @@ def _build_authentication_response( raise ValueError(f"Invalid home_directory_type: {home_directory_type}") if user_uid is not None: - response["PosixProfile"] = {"Gid": user_gid, "Uid": user_gid} + response["PosixProfile"] = {"Gid": user_gid, "Uid": user_uid} if policy: response["Policy"] = policy diff --git a/tests/unit/data_classes/required_dependencies/test_transfer_family_event.py b/tests/unit/data_classes/required_dependencies/test_transfer_family_event.py index 2e74d2d7457..962152097ab 100644 --- a/tests/unit/data_classes/required_dependencies/test_transfer_family_event.py +++ b/tests/unit/data_classes/required_dependencies/test_transfer_family_event.py @@ -90,6 +90,22 @@ def test_build_authentication_response_efs(home_directory_type): assert "HomeDirectory" not in response +def test_build_authentication_response_efs_posix_profile(): + # GIVEN a Authorizer response + response = TransferFamilyAuthorizerResponse() + + # WHEN building an authentication response for EFS with different uid and gid + response = response.build_authentication_response_efs( + role_arn="arn:aws:iam::123456789012:role/EFSAccess", + home_directory="/fs-12345678/user", + user_gid=1000, + user_uid=1001, + ) + + # THEN the PosixProfile uses the uid and gid that were passed + assert response.get("PosixProfile") == {"Gid": 1000, "Uid": 1001} + + def test_build_authentication_missing_home_directory(): # GIVEN a Authorizer response response = TransferFamilyAuthorizerResponse()