Start-up checks: a mistyped POSTULO_EMAIL_OAUTH_PROVIDER or POSTULO_EMAIL_OAUTH_GRANT passes and mail fails later #487
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#487
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 system checks against the settings they guard and running them with mistyped values.Checked again on 2026-10-01 against
mainat0a5cad587: still present. The code is now atcore/mail_auth.py:163-206(instance_token; the refusal for an unknown provider at:188, the comparison withMailGrant.APPLICATIONat:206), andMailGrantis defined incore/mail_choices.py:42and re-exported frommail_auth;core/checks.pyand the settings are where they were.core/checks.pyexists (#233) so that a setting with a fixed vocabulary is refused at start-up rather than surfacing at the first send. It checksPOSTULO_EMAIL_AUTH, but not the two variables beside it that also have a fixed vocabulary:POSTULO_EMAIL_OAUTH_PROVIDER(googleormicrosoft, the keys ofmail_auth.PROVIDERS) andPOSTULO_EMAIL_OAUTH_GRANT(blank,mailboxorapplication), both documented with those words in the wiki'sConfiguration.md:599-600. A variable pins its field over the Email page, so a typo there cannot be corrected from the interface.core/checks.py:28-33(CHOICES) and:61,choices; the settings atconfig/settings/base.py:729-730; their use incore/mail_auth.py:188-231,instance_token.POSTULO_EMAIL_AUTH=xoauth2andPOSTULO_EMAIL_OAUTH_PROVIDER=microsft, thepostulochecks return nothing (run against the snapshot with those settings), the entrypoint starts, and every message, password resets included, fails with "No identity provider is chosen for mail." (mail_auth.py:212).POSTULO_EMAIL_OAUTH_GRANT=aplication,instance_tokencompares the word withMailGrant.APPLICATION, finds it different and quietly takes the signed-in-once route (mail_auth.py:230), which on an instance set up for the application grant fails with "Nobody has signed in to the mail provider yet".googlewithapplicationis refused on the Email page by_refuse_a_grant_the_provider_lacks(core/server_forms.py:470), but the same pair from the environment is checked nowhere and fails on every send.check --deployand saw it pass.postulo.E008) that, whenPOSTULO_EMAIL_AUTHisxoauth2, requiresPOSTULO_EMAIL_OAUTH_PROVIDERto be a key ofmail_auth.PROVIDERS; that requiresPOSTULO_EMAIL_OAUTH_GRANTto be blank or aMailGrantvalue; and that refusesapplicationfor a provider whoseapplication_grantis false. Take the words frommail_authrather than adding a second list toCHOICES, so the check and the code that acts on them cannot drift.Done when
tests/test_checks.pyset each of the three combinations above and expect an error; they fail today because the checks return nothing.POSTULO_BACKUP_DOWNLOADfalls open to "every administrator" on any value it does not recognise, and no start-up check reads it #978