Request limits for presigned URLs
Presigned URLs in traditional object storage services (Tencent COS, Alibaba Cloud OSS, AWS S3) can only be limited by time, not by number of uses, which significantly weakens the security of object storage.
Bitiful S4 lets you limit the number of requests for presigned GetObject and PutObject URLs.
How to use it
When generating a presigned URL, add the x-bitiful-max-requests=10 parameter (replace 10 with the number of requests you want to allow).
On the 11th request, the system returns a 403 ReachTheMaxRequests error.
Security recommendation
When presigning a PutObject request, keep the expiration short (for example, 10 minutes) and set the maximum number of requests to 1. This helps prevent replay of presigned PutObject URLs.
Reference implementation
Bitiful has open-sourced a stateless presigned URL generation service that supports a range of security parameters and unique performance features.
| Parameter | Type | Required | Default | Description | Applies to |
|---|---|---|---|---|---|
| key | String | Yes | - | The object's key/path, which identifies the object in the S3 bucket | PUT & GET |
| content-length | Int | No | Unlimited | Length of the uploaded content in bytes; must be greater than 0 and no more than 1 GB (1024 MB) | PUT |
| no-wait | Int | No | 0 | Wait timeout in seconds for the "receive-as-you-upload" feature; maximum 10 seconds | GET |
| max-requests | Int | No | 0 | Maximum download count: the maximum number of times the URL can be accessed | PUT & GET |
| expire | Int | No | 3600 | URL validity period in seconds; defaults to 1 hour | PUT & GET |
| force-download | Bool | No | false | Whether to force a download (when set to true, an attachment response header is added) | GET |
| limit-rate | Int | No | 0 | Per-connection rate limit (bytes/second) | GET |
GitHub: https://github.com/bitiful/s3-presigned-api-server
Integrations
Bitiful Send, an open-source project from Bitiful, makes good use of this feature.
Demo: https://send.bitiful.com/ Source code: https://github.com/bitiful/send