Skip to content

generate_presigned_post presigned url upload is failing with invalid policy condition if key contains $$ #4514

@asvashrith

Description

@asvashrith

Describe the bug

We have file naming convention of keeping 2 "$$" as prefix or suffix such files are failing with Invalid policy condition of key when we upload them using presigned url generated from gemerate_presigned_post

s3_client = boto3.client('s3',api_version='2006-03-01',config=boto3.session.Config(signature_version='v4'))
response = s3_client.generate_presigned_post(
        Bucket="sample_bucket",
        Key="Folder/filename$$.txt",
        Conditions=conditions,
        Fields=fields,
        ExpiresIn=url_exp_time,
    )

AccessDeniedInvalid according to Policy: Policy Condition failed: ["eq", "$key", "/2025/0267$$Copy.csv"]

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

File should be uploaded even if it has $$ in the name or any other special characters as well.

Current Behavior

if key contains 2 dollar symbols consecutively then upload is failing here is a sample key "Business/new/abcd$$.pdf"

Reproduction Steps

Generate presigned post url pass Key with consecutive $$ for example: "new/abcd$$.pdf"

With presgined url trying uploading we'll get Invalid policy condition exception

Possible Solution

No response

Additional Information/Context

No response

SDK version used

1.37.38

Environment details (OS name and version, etc.)

Python and 3.11

Metadata

Metadata

Labels

bugThis issue is a confirmed bug.p2This is a standard priority issues3service-apiThis issue is caused by the service API, not the SDK implementation.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions