Restore: the key check counts only connections and says nothing is lost when the mail secrets are unreadable #481
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
performance
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Postulo/postulo#481
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found on 2026-09-29 in a read-only review of postulo at
95348908d, reading the restore report against every column encrypted with the field key.Checked again on 2026-10-01 against
mainat0a5cad587: still present. The code is now atcore/site.py:302(the read ofSiteSettings.email_password, which #248 moved up);core/backup.py, therestorecommand and the cited lines ofcore/models.pyhave not moved.The archive carries a fingerprint of the field key so that a restore can say whether the secrets it put back can still be read. The count behind that message looks only at plugin connections.
SiteSettingskeeps four more stores under the same key: the SMTP password, the mail OAuth client secret and tokens, the mail transport's secrets and the text transport's secrets. When the key differs and no connection holds a secret,restoreprints that nothing is lost, while the instance's own outgoing mail can no longer authenticate.core/backup.py:131-134,_connections_with_secrets:Connection.objects.exclude(secrets_encrypted="").count()and nothing else.core/backup.py:567-570, whererestore_backupfills the report.core/management/commands/restore.py:61-77, the two messages; the second reads "no connection holds a secret, so nothing is lost by it".email_password_encrypted,email_oauth_secrets_encrypted,transport_secrets_encryptedandtext_secrets_encryptedonSiteSettings(core/models.py:964,:998,:1010,:1021).POSTULO_SECRET_KEYand noPOSTULO_FIELD_KEY. The instance sends mail with an SMTP password or Microsoft 365 consent stored in Server settings.restorereports the key mismatch as harmless. From then onSiteSettings.email_password(read bycore/site.py:340) andemail_oauth_secretsraiseSecretsUnreadable, so password resets, sign-in codes and notifications that go by mail or text fail.*_encryptedcolumn onSiteSettings(secrets.encrypt({})writes"", so non-empty means a secret is there). Better, try to decrypt each and report which could not be read. Name the mail settings in the message, for example "re-enter the SMTP password or consent again on Server settings → Email", and extend the wiki's "Afterwards" to match.Done when
tests/test_backup.pystores an SMTP password inSiteSettings, takes a backup, restores under a different key, and asserts that the report counts it and the command does not print "nothing is lost"; it fails today.Related to #234 (closed), which introduced the fingerprint check this one is incomplete against.