1

I am developing a system for storage of medical records. A person could upload image(s) or file(s). Since it is a medical record , it needs to be stored in encrypted form.Also I want that the files or images could only be seen by authorised user. Can you please suggest what standards should I be using (The API is in NodeJS and using S3 for stoarage)?

1 Answers1

2

Word of advice: It's great that you are reaching out, but medical data is particularly sensitive and handling should be done by an experienced developer and the code should be peer reviewed. There is a lot at stake here and too many things can go wrong.

That said you need to take several aspects into consideration.

  • The first thing you need to do is a threat analysis. What threats do you need to protect yourself from?
  • Most likely you will also have to follow legal requirements. What are those? How are they checked?

On a more technical aspect, you will most likely need to consider these:

  • Upload and download need to be via HTTPS, preferable with a modern cypher suite.
  • Your S3 buckets must be private and access should only be allowed via signed URLs
  • Singed urls should be handed out by your application after checking that the user has indeed access to this resource. Validity of this URLs should be short, so that they can't be bookmarked or passed around.
  • How you encrypt the data is highly depended on your use case. I can only give you hints since I don't know where you need to take your application
    • If you encrypt in the backend, you need to setup a key management. It also means you will have to download the files from S3 to the backend, decrypt it, before you pass it to the client.
    • Client Side encrypt is possible, but again, key management is important. This will also have an impact on who can share files. If only the client has the key, they are the only one to decrypt it.
    • In both cases, you still have the issue that once the client can view the data in unencrypted form, it is available unencrypted and no longer protected.

Last but not least: do not implement your own cryptography. Select a popular library, make sure you understand it well, and keep it up to date with the latest security patches.

bhorkarg
  • 432
  • 2
  • 12
phisch
  • 1,305
  • 10
  • 14