-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SMTP Password Stored as Plaintext #1977
Comments
Probably, although I can't think of a way to encrypt it that couldn't be easily reversed by someone with access to the database. (I don't remember if the system encryption key is stored in the db; If not, encrypting settings would at least be useful for securing sensitive info at rest in db backups/snapshots.) In any case, the mailer component can be customized by config, which makes it easy to keep stuff like passwords/keys in env vars and out of the database. |
Agreed, it would realistically be obfuscation over encryption, however with an encryption key stored in the config file, any unauthorised database access (or db backups) would not compromise the sensitive password. Yii2 supports encryption/decryption of course so it would simply require some implementation in Craft. Storing the mailer settings in the config file offers some level of protection but it will still be in plaintext and it limits customisation of the mailer settings. |
We can’t hash the password without an encryption key. The one Craft auto-generates and places in |
Perhaps, but the advantage of a secure validationKey is that it can then be used by plugins to encrypt any sensitive data that they might store in the database. This is actually why I brought this issue up in the first place. I have created a custom mailer for a plugin and would like to encrypt the sensitive settings that are stored in the database and that should not be stored as plaintext. Yes, I can manage the encryption myself but it seems to make sense to me that if a validationKey exists that it be secure enough to use for data encryption. |
We’re thinking maybe we can solve the unreliableness of the validation key, by doing a better job of encouraging people to define one in their config (or better yet, their |
Cool, any reason that the validation key can't be made reliable by default in Craft 3? |
Nope, that’s what we’re looking into. |
These commits are looking good so far :) |
i noticed that the smtp password is stored crypted in version v3.0.36 When updating from 3.0 to 3.1 you can see the raw base64 string in the admin. If i change the password, then it's in plaintext and it's plaintext in a new created sql dump. I found in https://github.com/craftcms/cms/blob/develop/CHANGELOG-v3.md#310---2019-01-15 a related entry:
So it's maybe related to: #3219 ?!? |
Becuase this is an autosuggest field that supports environment variables, I'm guessing it has to be a plaintext field. Probably best to use and environment variable to protect the password. |
Hm, okay... I think it's a step backwards to the solution before this issues was closed, isn't it?
And what's the way to migrate? As i've written: after v3.0 -> v3.1 update i see a |
That was never the case. Before 3.1, SMTP passwords were encrypted within the Email settings form UI just to make it harder to quickly learn them just by going to the Email settings page and copying the input value. But they were still stored in plain text in the database. That situation was made worse by project configs, because now the password isn’t just stored in plain text in the database, but also potentially in your So that and other sensitive fields is the reason we added support for environmental settings (#3219), where you can enter an environment variable name into the field input, and that variable name is what gets stored in the DB and We technically could have continued to encrypt the current SMTP password value in the UI if it’s not set to an environment variable, and we considered that, but decided against it because it’s better to make it painfully obvious that the password is stored in plain text so people address it, rather than give them a false illusion of security. |
Description
The SMTP password is stored as plaintext in the systemsettings table of the database. While being able to read and use this password is obviously required for Craft to send emails over authenticated SMTP, shouldn't it be hashed or encrypted?
Additional info
The text was updated successfully, but these errors were encountered: