Search code examples
pythonpython-3.xsecuritypasswordspassword-encryption

Is it dangerous to store a password in a variable?


I'm writing a GUI program with PyQt5 which takes the user's password for entering the app, I need to store the entered password in the memory for further processing, is it dangerous? I found this thread:

Is it safe to store passwords in powershell's $env variable?

Based on the above link, it's OK, but I'm still in doubt. Or if storing plain text password in the memory is dangerous, encrypting and saving it in a variable could be a better solution?


Solution

  • There is no issue with storing a plain text password in a memory variable. It is quite common and would be normal for an application to decrypt a secure password and store it in memory.