I've been diving into AWS for the past three months and while I've got the basics down, I still feel a bit out of my depth when it comes to hands-on experience. I'm currently working on a project where my client wants to implement an in-house KYC (Know Your Customer) solution using a Node.js backend and a React.js frontend. We've successfully handled file uploads through our Node.js server using the AWS SDK, but now I'm stuck on how to handle document retrieval securely.
The admin panel requires logging in with MFA (Multi-Factor Authentication), and I'm debating between using presigned URLs for document retrieval or using signed URLs through CloudFront with appropriate origin access policies. Is storing these crucial KYC files in S3 a secure choice?
I'm also a bit confused about how signed URLs differ from presigned URLs if they can still be viewed in browser dev tools—what's the actual security enhancement? Could a signed URL via CloudFront be a solid solution when combined with strong MFA for the admin login? I'm really looking forward to your insights and guidance on this!
3 Answers
S3 presigned URLs are great for uploading files, but for read access, presigned cookies through CloudFront are the way to go. However, be aware you can't mix the two in terms of permissions effectively—it's about managing uploads and read access separately. In my recent project using Next.js, I found presigned cookies efficient for read access while keeping file uploads through presigned URLs. It helps reduce overhead, keeping things streamlined.
Absolutely, S3 is ideal for storing these types of files—just make sure to apply the necessary security measures to your bucket. When it comes to signed URLs versus presigned URLs, there's a big difference. A presigned URL grants access to anyone who has it, making it vulnerable if it falls into the wrong hands. On the other hand, signed URLs allow for more control—you can set parameters like IP address ranges to restrict access and enhance security.
Also, with CloudFront, you're leveraging the CDN capabilities, which can help with performance too!
Using signed URLs with an expiry time is a best practice, especially for sensitive documents like KYC files. In my previous work with a fintech company, we implemented a solution where each user had a unique STS (Security Token Service) token to generate their own signed URLs with an expiration time. This way, if anyone stole a URL, it would be useless after a short window. It's crucial to minimize the amount of time the document is accessible, so definitely consider this approach.
Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically