Skip to content

Commit 4624628

Browse files
fix(data-classes): use user_uid for the Uid in Transfer Family PosixProfile (#8524)
Co-authored-by: Leandro Damascena <lcdama@amazon.pt>
1 parent 66d3e3b commit 4624628

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

‎aws_lambda_powertools/utilities/data_classes/transfer_family_event.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def _build_authentication_response(
6767
raise ValueError(f"Invalid home_directory_type: {home_directory_type}")
6868

6969
if user_uid is not None:
70-
response["PosixProfile"] = {"Gid": user_gid, "Uid": user_gid}
70+
response["PosixProfile"] = {"Gid": user_gid, "Uid": user_uid}
7171

7272
if policy:
7373
response["Policy"] = policy

‎tests/unit/data_classes/required_dependencies/test_transfer_family_event.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,22 @@ def test_build_authentication_response_efs(home_directory_type):
9090
assert "HomeDirectory" not in response
9191

9292

93+
def test_build_authentication_response_efs_posix_profile():
94+
# GIVEN a Authorizer response
95+
response = TransferFamilyAuthorizerResponse()
96+
97+
# WHEN building an authentication response for EFS with different uid and gid
98+
response = response.build_authentication_response_efs(
99+
role_arn="arn:aws:iam::123456789012:role/EFSAccess",
100+
home_directory="/fs-12345678/user",
101+
user_gid=1000,
102+
user_uid=1001,
103+
)
104+
105+
# THEN the PosixProfile uses the uid and gid that were passed
106+
assert response.get("PosixProfile") == {"Gid": 1000, "Uid": 1001}
107+
108+
93109
def test_build_authentication_missing_home_directory():
94110
# GIVEN a Authorizer response
95111
response = TransferFamilyAuthorizerResponse()

0 commit comments

Comments
 (0)