Add support for encrypting system settings
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 1.5k
- Forks
- 246
- Avg merge
- 19h 2m
- Merged PRs (30d)
- 7
Description
Description
The SMTP password configured via Settings → Mail → Mail Configuration (backend/system/settings/update/winter/system/mail_settings) is stored in plaintext in the system_settings table (item = 'system_mail_settings'), inside the smtp_password field of the serialized JSON value.
Steps to reproduce
- Go to
Settings → Mail Configurationin the backend. - Set
Send modeto SMTP and fill in SMTP credentials (host, user, password). - Save the settings.
- Query the database directly:
SELECT value FROM system_settings WHERE item = 'system_mail_settings';
- Observe that
smtp_passwordis stored in plaintext, readable by anyone with read access to the database.
Expected behavior
The SMTP password should be encrypted at rest (e.g. using Laravel's Crypt facade / an encryptable attribute on the MailSetting model), similar to how other sensitive credentials are typically handled in the framework.
Actual behavior
The password is stored as plain, human-readable text in the database.
Environment
- Winter CMS version: 1.2
- Laravel version: Laravel Framework 9.52.21 - Winter CMS
- PHP version: 8.4
- Database: PostgreSQL
Security impact
Anyone with read access to the database (backup files, replicas, misconfigured permissions, a compromised low-privilege DB account, etc.) can retrieve the SMTP credentials in plaintext, which could be used to send email as the configured sender or to attempt credential reuse against the mail provider.
Suggested fix
Encrypt the smtp_password field before persisting it (and decrypt on read), consistent with how other sensitive fields are protected elsewhere in the codebase.`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at backend/system/settings/update/winter/system/mail_settings and trace how the MailSetting data is persisted in the system_settings table, including the smtp_password field. Check how sensitive fields are protected elsewhere in the codebase; done means the password is no longer readable at rest while SMTP settings can still be used normally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- laravel, php
- Domain
- backend, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100