By default, the Django database host/user/password are stored in the project settings.py file in plain text.
I can't seem to think of a better way at the moment, but this seems to be against best practices for password storage. Granted, if an attacker has access to the settings file, then all is probably already lost. Even if the the file were encrypted, the attacker would probably have the means to decrypt it by then.
Is this okay?
Solutions for secure storing and sharing passwords First and foremost, make sure that storing and sharing passwords in plain text is no longer your (and your colleagues') habit. Instead, build some new ones! For storing passwords, forget all those sheets, notepads and Sticky notes – use encrypted password storage.
Plaintext Passwords Are Not Secure! Plaintext just means your password is stored exactly as you write it. And that's a problem because hackers can easily read it. Be sure to read up on credential dumping and how to protect yourself.
Plaintext just means normal, everyday language. If your password is stored in plaintext, it is left visible in databases which may not be secure. In cryptography, it refers to a message before encryption. When a plaintext message gets encrypted, the characters become scrambled and unintelligible.
You are correct that storing passwords in plaintext and in a settings.py file is not good security. You could increase security by:
Setting the permissions correctly (this will depend on your set up). Ideally only python should be able to read the file.
Storing the file out of the www
or htdocs
root. If at this point an attacker still has access to them, you are screwed anyways.
For added security, you can encrypt the connection settings using symmetric encryption (eg: AES). Store the key somewhere else. So even if someone managed to access the connection settings, they'd still need to find the key. The main drawback is that now you have to rewrite the connection method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With