Encryption and keys
Which keys Bugsoft Portal uses, what they encrypt, who can decrypt, and how to change keys.
This page describes the key model, for people who must assess it. How you manage and keep the keys day to day is on Keys and secrets on the server.
In short
- Saved passwords are encrypted in the database. The keys are outside it, in
.env. - Whoever has both the database and
.envcan read the saved passwords. Keep them apart. - Whoever loses the keys can never read the saved passwords again.
Two encryption suites
During the installation, Bugsoft Portal chooses one suite, which never changes afterwards (CRYPTO_SUITE in
.env):
| Suite | Algorithm | When |
|---|---|---|
sodium | XChaCha20-Poly1305 (libsodium) | Default if PHP has the sodium extension. |
openssl | AES-256-GCM with its own key per message (HKDF-SHA256) | For servers without sodium, or that require FIPS-approved algorithms. |
Both are authenticated encryption: a value that was changed or moved is refused. Each value is bound to where it belongs (for example vault, item and field), so you cannot copy encrypted text to another record.
The keys
| Key | Where | What for |
|---|---|---|
APP_KEY | .env | Separate subkeys are derived from it for the sessions, the TOTP secrets of emergency accounts, the HMAC of the audit log, and ordinary data, such as the key for push notifications and the sign-in secrets you enter on the web page. |
VAULT_KEKS and VAULT_KEK_ACTIVE | .env | The key encryption keys (KEKs) for the saved sign-in details. They only encrypt the data keys. |
| Data keys (DEKs) | Database, encrypted with a KEK | One per store of sign-in details (a person's own passwords, shared logins for everyone, formulas). They encrypt the user name, the password, the notes, secret fields and the key for the code from an authenticator app. |
| Signing key of Bugsoft Connect | storage/keys/ | Signs the installation package of the extension (the extension ID depends on it). |
| Sign-in secrets you enter on the web page | Database (app_secrets), encrypted with APP_KEY | For example the client secret for sign-in. If the same secret is in the server environment or in a *_FILE, that one wins, and the page can only show it, not change it. |
This is envelope encryption on the server: the data is encrypted in the database, the keys are outside it
in .env. Decrypted data keys are only in memory during a request. They never go into the cache, the session or a
log file.
The passwords of emergency accounts are not encrypted but hashed (Argon2id, or bcrypt with cost 12 if PHP has no Argon2id). Employees have no password of their own in Bugsoft Portal: they sign in at the sign-in system of their organisation (Microsoft Entra ID or another system).
Who can decrypt
Whoever has both the database and .env can read all saved sign-in details. And whoever has
lost the keys can never read them again.
- An employee only sees their own passwords. Shared logins for everyone and formulas are, by default, only filled in by Bugsoft Portal ("sign in only"); they are then in the form of that website.
- Administrators in Bugsoft Portal never see anyone's own password. The admin page Passwords only shows numbers.
- A server administrator with access to the database and
.envcan decrypt everything. Limit that access, and log who has it. - Whoever only has a database backup (without
.env) cannot read the passwords, notes and TOTP secrets. They can read names, e-mail addresses, tiles, calendar and the audit log: these are stored readable in the database. - On your own server, Bugsoft has no access to the server and no key. When Bugsoft hosts Bugsoft Portal for you, the database and the keys are in your own environment on its servers: only its own staff manage those servers, and the backups are encrypted for a key that is not on the hosting server. See the data processing agreement for hosting.
Keep .env and the backups apart
- Keep
.envin a password manager or secrets vault of IT, not next to the database backups. - Docker: with
BACKUP_ENCRYPT_CERT, the backup encrypts the keys with a certificate whose private key only the security team has. - Secrets can also be in files (
APP_KEY_FILE,VAULT_KEKS_FILE,DB_PASSWORD_FILEand so on), for example as a Docker or Kubernetes secret. production:checkwarns if.envis readable by anyone other than its owner, and gives an error if it is in the web folder.
Change keys
| Key | How | What happens |
|---|---|---|
| KEK | php bin/console vault:keygen, add the new key to VAULT_KEKS and raise VAULT_KEK_ACTIVE, then php bin/console vault:rotate-kek | All data keys are encrypted again. When nothing uses the old KEK any more, remove it (keep it with the old backups). |
| DEK | php bin/console vault:rotate-dek {id} | One store gets a new data key, and everything in it is encrypted again. |
APP_KEY | php bin/console key:generate --force, in a maintenance window | Everyone must sign in again, the emergency accounts link their authenticator again, the audit log starts a new chain, and the sign-in secrets entered on the web page must be entered again. Run php bin/console audit:verify first. |
| Signing key of Bugsoft Connect | php bin/console vault:knop-key --rotate | Only after misuse: the extension gets a new extension ID, and IT must change the policy on every PC. |
The connection to the database
Is MySQL or MariaDB on another server? Then switch on TLS with DB_SSL_CA (the CA file), and if needed
DB_SSL_CERT and DB_SSL_KEY (a client certificate).
DB_SSL_VERIFY checks the certificate of the database server. It is on by default as soon as there is a CA.
production:check warns when the database is not on the same server and TLS is off. SQLite is a file on the server
itself and has no network connection.
Stuck? See Questions and problems or contact Bugsoft at ugurs156@gmail.com.