Files
bambuddy/backend/app
jmoore-skild 737258202b fix(backup): never restore the auth policy settings from a backup (#2656)
_collect_settings exports every Settings row minus two credential keys, so
auth_enabled / advanced_auth_enabled / local_login_enabled / setup_completed
all travel in a backup, and none of them are credential-shaped enough for
_SECRET_KEY_HINTS to catch. Writing them back was the one part of a settings
restore that changed who can reach the instance rather than how it behaves:

* auth_enabled=false — from any backup taken before auth was turned on —
  disabled authentication. core.auth caches only the enabled=True result, on
  a 30 s TTL, precisely so staleness fails closed; set_auth_enabled pairs its
  write with invalidate_auth_enabled_cache(). The restore did neither, so it
  left the stored value the open one.
* local_login_enabled=false walked straight past the #1589 refusals in
  update_settings (no enabled OIDC provider / no OIDC link on the caller),
  which exist to stop exactly that lockout.
* /github-backup/restore is gated on GITHUB_RESTORE alone, so honouring these
  keys made that permission a way to rewrite auth config without
  SETTINGS_UPDATE.

Flipping an existing row needed overwrite_existing, so the odds were lower
than the severity. Both refusals now share _is_skipped_setting_key so the
preview's item count still matches what a restore writes, and the skipped
keys get their own note pointing at the auth UI rather than being folded in
with the credential ones.
2026-08-04 08:22:58 -04:00
..
2026-06-26 14:40:25 +02:00
…