Skip to content

Commit 3c9efec

Browse files
authored
fix(s3): prevent generate_presigned_post from mutating Conditions (#3847) (#3852)
1 parent 750c41d commit 3c9efec

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "bugfix",
3+
"category": "s3",
4+
"description": "Prevent generate_presigned_post from mutating the caller's Conditions list."
5+
}

‎botocore/signers.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,8 @@ def generate_presigned_post(
932932

933933
if conditions is None:
934934
conditions = []
935+
else:
936+
conditions = conditions.copy()
935937

936938
context = {
937939
'is_presign_request': True,

‎tests/unit/test_signers.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,6 +1110,7 @@ def test_generate_presigned_post_with_prefilled(self):
11101110
)
11111111

11121112
self.assertEqual(fields, {'acl': 'public-read'})
1113+
self.assertEqual(conditions, [{'acl': 'public-read'}])
11131114

11141115
_, post_kwargs = self.presign_post_mock.call_args
11151116
request_dict = post_kwargs['request_dict']

0 commit comments

Comments
 (0)