I have an image that I've uploaded to S3 using a presigned url. At first, the image was viewable when...
- used in my app's
image_tag
, or - used in an
<img src="">
of any html doc.
...however it was not viewable when copypasted into my browser.
Now that the expiration date has passed, the image is still viewable...but only when requested by my app. Isn't the expiration date supposed to prevent access?
I read somewhere that the expiration date was only supposed to impact file uploading, but responses to this question state otherwise.
The expiration is relevant to the URL only not to the object itself. If you upload an object using a pre-signed URL and configure the pre-signed URL with a public-read ACL, the object will be public to anyone. Still, if you upload it with a private ACL configuration, you could only upload this object. To read it, you need to create a new pre-signed URL with the
getObject
operation. I wrote an article on how to work with pre-signed URLs, it is in nodeJS but I think it could help you. Check out the code snippets.https://www.altostra.com/blog/aws-s3-presigned-url