Server settings → Sign-in and Defaults: saving overwrites the stored value of a field the environment pins #492
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#492
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 Server settings forms and posting them in a test with a variable set.Checked again on 2026-10-01 against
mainat0a5cad587: still present. The forms and templates are where they were; the views are now atcore/server_views.py:453-457(SignInView) andcore/server_views.py:564-568(DefaultsView).When the environment pins a field on the Sign-in page (
POSTULO_REGISTRATION_OPEN,POSTULO_OIDC_IS_SECOND_FACTOR) or on Defaults (POSTULO_TIME_ZONE), the template draws a notice in place of the input, butSignInFormandDefaultsFormstill carry the field. The missing value is cleaned to an empty answer and written to the row, so any save of those pages quietly replaces what an administrator had stored.CaptureFormandEmailFormalready refuse pinned fields for exactly this reason; these two forms were never given the rule. Related to #84 (closed), which set the rule for the email settings: "the server must refuse the write regardless".core/server_forms.py:39-73(SignInForm) andcore/server_forms.py:248-271(DefaultsForm), neither of which computesself.pinnedor drops it inclean(); compareCaptureForm.cleanatcore/server_forms.py:146-151andEmailForm.cleanatcore/server_forms.py:458-467. The inputs are left out bytemplates/server/signin.html:69-81andtemplates/server/defaults.html:36-45; the views areSignInView(core/server_views.py:452-456) andDefaultsView(core/server_views.py:563-567).registration_open = True. The operator later setsPOSTULO_REGISTRATION_OPEN=false. Somebody saves the Sign-in page to switch on email sign-in; the row now holdsFalse(checked: posting the form with the variable set leftregistration_openatFalse). When the variable is removed, registration stays closed rather than returning to what the administrator chose. In the same way, withdefault_time_zone = "Europe/Lisbon"stored andPOSTULO_TIME_ZONEset, saving Defaults to change the instance name storesdefault_time_zone = "".PinnedPolicyForm) that computesself.pinned = {field: variable for field in self.fields if (variable := site.overridden_by(field))}in__init__and pops those names fromcleaned_dataanderrorsinclean(), and haveSignInForm,DefaultsForm,CaptureFormandEmailForminherit it, so the rule cannot drift again. Fixing the empty-value handling ofPolicyFieldalone would not help: the pinned field would then be written asNonerather thanFalse, still overwriting the stored answer.Done when
tests/test_server_settings.pyhas a test that storesregistration_open = True, setsPOSTULO_REGISTRATION_OPEN, posts the Sign-in page and findsTruestill stored, and one that stores a default time zone, setsPOSTULO_TIME_ZONE, posts Defaults and finds the time zone unchanged. Both fail today.