Git Product home page Git Product logo

Comments (9)

majora2007 avatar majora2007 commented on May 28, 2024 1

You can generate a key on startup of your application which will be used to encrypt your user/password. The key can be stored outside the database on the user's machine and read into memory at startup.

Then you can decrypt the username/password. This is a very simple solution, unless you want to use an external library that might offer more realistic implementation strategies.

from kapowarr.

Casvt avatar Casvt commented on May 28, 2024

So basically: "Encrypt it with a key and put the key somewhere on the system, outside the database"? That doesn't solve the problem. The project is open source so everyone can simply figure out where the key would be stored and when "stealing" the database, also grab the key and use it to still get access to the raw credentials. It's basically no better than storing the key in a variable inside the code.

from kapowarr.

majora2007 avatar majora2007 commented on May 28, 2024

Generate it per user on their machine based on machine info. I do this for my codebase for JWT encryption (not credentials).

Yes, if you have access to the users machine, then you'd be compromised. You could do some hardware based key to generate a unique encryption key, but then you wouldn't be able to move from one instance to another. Likewise with docker could hit some roadblocks.

Just wanted to throw some suggestions out, I'm honestly not sure how to solve with a home grown solution.

from kapowarr.

ajurna avatar ajurna commented on May 28, 2024

I think in a professional env I would put it in azure key vault or similar. usually the recommendation is store them in a config file or the env variables rather than a DB.

Encrypting them does no use if the weak point if the front end. if I can bypass auth and get the settings API to load then it doesn't matter what encryption you use it will be decrypted for me.

from kapowarr.

majora2007 avatar majora2007 commented on May 28, 2024

I would recommend to just look at what was done in sonarr and model after that. Open source has a lot of limitations as all code is visible, so if you want to add extra security, you have to put more onus onto the user when setting up the application (like setting env variables, etc).

from kapowarr.

RationalAnarchist avatar RationalAnarchist commented on May 28, 2024

As I understand it, for Mega at least, you need to send the username and password over in encrypted form (base64?). So what I'd do is store the username and the encrypted string. The application has what it needs to get the data and if someone gets hold of the db, they can still use it to access the mega account but nothing else (the big risk of plaintext passwords is where passwords are reused).

from kapowarr.

opicron avatar opicron commented on May 28, 2024

Generate a key on install, and salt the passwords before encrypting. Decrypt the values from env/db when required.

https://github.com/tasos-py/AES-Encryption-Classes/blob/master/aes_encryption.py

from kapowarr.

Casvt avatar Casvt commented on May 28, 2024

So:

  1. Generate a key
  2. Use it to encrypt the data and store it
  3. Use it to decrypt the stored data for usage in code

The problem then is that everyone that has access to the database file can also just grab the key to decrypt everything. It's like having a lock, but with the key hanging next to it; does the lock really work then?

from kapowarr.

opicron avatar opicron commented on May 28, 2024

I think the key has to be at another point than the database at least. But yes, you are right-- for example Wordpress handles it the exact same way.

from kapowarr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.