aws / aws-sdk

Landing page for the AWS SDKs on GitHub
https://aws.amazon.com/tools/
Other
68 stars 12 forks source link

Restrict file size for upload when creating presigned URLS #671

Closed jmklix closed 3 months ago

jmklix commented 5 months ago

Original issue: https://github.com/awslabs/aws-sdk-rust/issues/1013

Describe the feature

I would like to see a similar option as described here: https://stackoverflow.com/questions/13390343/s3-direct-upload-restricting-file-size-and-type and/or here: https://boto3.amazonaws.com/v1/documentation/api/1.9.42/reference/services/s3.html#S3.Client.generate_presigned_post as well as: https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-HTTPPOSTConstructPolicy.html#sigv4-PolicyConditions.

Apparently, setting a content-length-range as a 'condition' should prevent users to upload files larger than allowed. Is it possible to add that to this crate?

Use Case

I don't want users to upload huge files

Proposed Solution

Add another method:

let presigned_result = context
    .aws_s3_client
    .put_object()
    .bucket(&*common::properties::AWS_S3_BUCKET_NAME)
    .key(path)
    .XXX // <--- Here some logic?
    .presigned(presigned)
    .await;

Other Information

Maybe PUT should be changed to POST because I think only POST can handle the conditions.

Acknowledgements

A note for the community

Community Note

jmklix commented 5 months ago

P112094885

jmklix commented 3 months ago

This has been added to the feature request backlog for the service team. Currently we can't provide an ETA for when this will be added to the sdks. Closing this issue for now since this request in in the service teams backlog.

github-actions[bot] commented 3 months ago

This issue is now closed.

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.