I want to upload a file to S3 directly from client browser. I don’t want that file to go through my server.
After doing some research I am seeing two ways to do this:
[Cognito Identity][1]
[Upload using HTTP POST form][2]
Issue with Cognito Identity is that we are not using a user pool. We are authenticating using our database without AWS Cognito User Pool. And without that we only have ‘IdentityPoolId’, which according to me, anyone can copy from our website’s JS code and upload objects to our S3 bucket. Correct me if I am wrong with this assumption.
Using HTTP POST form seems OK to me but while researching I am seeing that Cognito is the new way to do this and I’m afraid that I’m missing something.
If you’re only using Cognito Identity Pool with Unauthenticated access, don’t upload from the browser. Unauthenticated access is really just getting temporary credentials from Cognito and signing the request with those credentials.
One question, although you have your users in a DB, have you looked at some of the customizations you can do with the User pool to hit a lambda at various stages of the login? I’m thinking the lambda could look up your user and validate it, which still gives you the ability to use all of the benefits that Cognito gives. I haven’t dug into this thought thoroughly but it might work. My personal opinion is that writing you’re own login process is bad and susceptible to being hacked. Cognito is pretty easy and with the Amplify framework works with all major web development platforms.
Makes sense but I don’t think management will like such a big change. I think I’m just gonna stick with HTTP POST upload. Thanks for your reply though.
No problem. I understand the pressure from management and non-tech savvy managers who make bad tech decisions really irck me. This is why companies get hacked.
Hopefully, what your users are uploading is not any PII (personally identifiable information), HIPAA, or anything else that they would expect to be secure.
Here’s a good video on someone that does this and she talks about how easy to hack devs make some of these apps.