Skip to content

[Feature] SSO-only mode: block local password login except for the default super admin #676

Closed

Description

@pikann

Summary

Add an opt-in, backend-enforced "SSO-only" policy that rejects local password authentication, where only the default super admin account can still use password login through a hidden sign-in entry.

Problem

How sign-in works today:

  • POST /auth/login (auth.Service.Login) looks the user up by username and checks the bcrypt hash. It does not know whether the account is SSO-managed.
  • SSO sign-in (sso.Service.CompleteLogin → ResolveUser) ends in the same IssueSession. Auto-provisioned accounts get a random, unguessable password, but nothing stops that from changing: an admin PATCH /admin/users/{id}/password, a password-set-token email (POST /auth/password/set), or PATCH /me/password can give an SSO user a usable password.
  • With LinkByEmail, an SSO identity can be linked to a pre-existing local account that still has its password.

So a user removed from the IdP group (the IdP group policy) can keep signing in with a local password, which defeats the policy.

Proposed Direction

  • Instance-level setting (e.g. auth.sso_only), default off, so existing installs are unchanged. Cannot be enabled unless at least one SSO provider is enabled, to avoid lock-out.
  • When on, the login page shows only the SSO providers. The username/password form is hidden by default but still reachable through a dedicated admin sign-in entry (e.g. a "Sign in as administrator" link or a separate URL), so no CLI or env var is needed for recovery.
  • Only the default super admin account may use password login while SSO-only is on. This is the account Paca seeds at startup from the admin config (it holds the SUPER_ADMIN role; see seedAdmin in internal/bootstrap). It can always sign in this way, so it can still configure settings and recover from a broken IdP setup. How the backend identifies this account (e.g. a persistent "bootstrap/default admin" marker on the user, rather than matching a username or role name) is to be decided in the issue. Other users holding SUPER_ADMIN or admin permissions are not exempt.
  • Enforce in the backend, not just the UI: /auth/login rejects every user except the default super admin with a clear policy error; password set/reset/change flows (/auth/password/set, /admin/users/{id}/password, /me/password) cannot give other SSO users a working password path; LinkByEmail cannot be used to bypass it.
  • Decide how password login is handled for other existing local accounts when the policy is turned on (blocked until they sign in via SSO and link).
  • Log password sign-ins made while SSO-only is on.
  • Revoking existing sessions is covered by the separate session revalidation work, not here.

Scope

  • Product behavior, Architecture (auth/user/sso services, settings), Admin UI, Documentation (including recovery runbook), tests

Acceptance

  • With SSO-only on, password login by any user other than the default super admin is rejected by the API, and password set/reset/change cannot give them a usable password path.
  • The default super admin can still sign in with username and password through the hidden admin entry and turn the policy off.
  • The policy cannot be enabled without a working provider.
  • Tests cover enforcement and the default super admin exception; docs describe the hidden admin sign-in entry and recovery.

Additional Context

Raised in Discussion #673 (follow-up to #431). Extra hardening for the default super admin's password login (MFA, IP restriction) is out of scope here, since Paca has neither today; this is tracked separately as an MFA / IP allow-list feature. Can ship independently of the IdP group policy.

Activity

  1. added
    enhancement
    on Oct 31, 2026
  2. pullfrog commented on Oct 31, 2026

    @pullfrog
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions