Skip to content

Add a server Owner role that alone can change admin roles #1382

Description

@zZebrahz

Problem

Every admin has the same authority. At d4e35ba9 there is no owner or super-admin role; the account created by first-run setup is an ordinary admin (internal/auth/service.go, SetupInitialUser). I found no guard that protects the original admin, other admins, or the last remaining admin.

As a result, any admin can demote, disable or delete another admin. That also works around the “can't impersonate another admin” rule: demote admin B to user, then View as B. The impersonation start check only refuses targets that are admins at that moment (internal/auth/service.go, StartImpersonation).

This is from source review only; the demote-then-impersonate path has not been tested at runtime.

Proposal

  • Owner claims the server. The account created during first-run setup becomes the Owner. There is exactly one Owner.
  • Transfer. Only the current Owner can transfer ownership to another account, which makes that account the Owner. The previous Owner stays an admin unless changed.
  • Role changes. Only the Owner can change another admin's role, or promote any account to admin. Admins can still manage regular users.
  • Protected accounts. Admins cannot demote, disable, delete, reset the password of, or sign out the Owner or other admins. The Owner can do all of these to any account except their own ownership, which only a transfer changes.
  • Impersonation. With admin roles protected, admins can no longer get around the admin-target rule by demoting another admin first.

Things to decide

  • Existing servers. Which account becomes Owner on upgrade, for example the earliest-created enabled admin, and whether the Owner is shown and confirmed in the admin UI.
  • Recovery. How to recover if the Owner account is lost or locked out, for example a server-side CLI command.
  • Other write paths. The same rules need to apply to every route that changes accounts: v2 and the frozen v1 routes, scoped and unscoped API keys, invitations that grant admin, and provider-managed role claims (feat(auth): support auth-provider connection checks and managed role claims #554). A provider sync must not demote the Owner.
  • Owner's own account. Whether the Owner can demote, disable or delete themselves without first transferring ownership. Suggested: no.

Validation references

Surfaced while reviewing #1198 (Admin impersonation, AC2 “cannot target another admin or escalate privileges”) and #1195 / #1197 (User management). Not marked as blocking.


AI-assisted: drafted with Claude Code (claude-opus-5-5) and GitHub CLI at the maintainer's direction. The proposal reflects the maintainer's direction; source findings are at d4e35ba9 and have not been runtime-tested.

Activity

  1. added theissue type on Sep 24, 2026
  2. zZebrahz commented on Sep 24, 2026

    @zZebrahz
    ContributorAuthor

    Related: #1403 proposes that admins default to full access, the same as the Owner, and that only the Owner can set per-admin overrides once this role exists.

  3. Quick104 commented on Sep 26, 2026

    @Quick104
    Contributor

    #1504 added the Owner and protects the Owner's own account. #1523 covers the rest of this issue. Only the Owner can grant the admin role or change another admin's account, which also closes the demote-then-View-as path. The PR also adds ownership transfer (POST /api/v2/admin/users/{id}/transfer-ownership and "Make owner" in Web) and silo owner set <username> for recovery. The issue closes when #1523 merges.

    Checked on shared dev with the branch deployed, acting as an admin that is not the Owner. Before, it could edit, disable, demote, delete, reset, and create keys for another admin. It could also promote, create, or invite admins, and View as an admin it had just demoted. Now each of those returns 403. Ordinary accounts and its own account still work. Transfer and the recovery command moved ownership and back.

    Evidence: https://evidence.siloserver.org/r/silo-server/issue-1382/

    Checked by Claude Code (claude-opus-5-5) with curl and headless Chromium, at the maintainer's request.

  4. zZebrahz commented on Sep 27, 2026

    @zZebrahz
    ContributorAuthor

    @Quick104 Nitpick:

    Image

    Should we just show Owner instead of Owner and Admin on the /admin/users list as well as on the /admin/users/[userid] page?

    Also should we show Role: Owner on the owner's edit user page?

    Image
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

    No labels
    No labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions