I am working on React and Django Rest Framework with AWS. I don’t have Public Access blocked on AWS. I am running short on time as I have to complete my project. I want users who access my website to not be able to right-click and copy the download button link. Because then they can save it and share it.
Any suggestions? I was wondering if I could disable the copy link address for the download button. That would make things much easier for me.
code snippet illustrating how to disable the copy link address for a button
2
Answers
Your best approach here is to generate an expiring link to the S3 object. Give it a short expiration time – a couple of minutes, or even less if you only generate it when the user only clicks the link – and sharing it around thus won’t be all that useful.
https://docs.aws.amazon.com/AmazonS3/latest/userguide/ShareObjectPreSignedURL.html
In Python, you can use Boto to do this. https://boto3.amazonaws.com/v1/documentation/api/latest/guide/s3-presigned-urls.html
You can disable right click using this