I use S3 to accept direct orders from a user on S3. Therefore, I will use pre-signed URLs.
After a successful upload, AWS Lambda will verify that the file upload is an image, and then the client will tell my server that it has finished uploading.
Then my server checks if this file exists in S3 (if Lambda detects an invalid image, it deletes it). If so, then the rest of the application logic will follow.
However, there is a loophole in this mechanism. The user can use the same URL to download the malicious file after he informs my server that he has finished the download (and originally transferred the valid file).
Lambda will delete the file anyway, but now my server will think that the file exists, but in fact it doesn’t exist.
Is there a way to generate a one-time downloadable pre-signed URL, or is it possible to forcefully cancel the URL that was generated but not expired yet?
source
share