Warracker icon indicating copy to clipboard operation
Warracker copied to clipboard

Allow linking pre-existing user to OIDC SSO

Open nareddyt opened this issue 1 year ago • 6 comments

Context: I just migrated warracker from username/password login to OIDC SSO.

Problem: I cannot link my pre-existing user account to OIDC SSO.

When I try to login using SSO, I get the following error:

The email address from your SSO provider is already associated with an existing local account. Please log in with your local credentials or contact support.

Ask: How can I link my SSO user to my pre-existing user, so I can login with SSO instead of username/password?

nareddyt avatar Nov 23 '25 04:11 nareddyt

Hi @nareddyt , great idea. I have it on my list of SSO enhancements for later on.

In the meantime, change your email on the current account, and then try to use the SSO to login.

sassanix avatar Nov 28 '25 15:11 sassanix

Thanks for the reply @sassanix . I am also happy to help contribute the feature - I imagine we'd have a "Sign in with SSO" button in the user settings that allows linking the account.

In the meantime, change your email on the current account, and then try to use the SSO to login.

Sounds feasible, but the warranties tied to my current account will no longer show on the SSO account. I do want to keep all my pre-existing data.

nareddyt avatar Dec 03 '25 02:12 nareddyt

Your OIDC provider needs to have these groups set.
I’m not sure exactly which ones are needed but owner and owners covers both.

groups:
  - "admins"
  - "admin"
  - "owner"
  - "owners"

luci-serendipity avatar Dec 16 '25 07:12 luci-serendipity

I did more digging on this. Even if we fixed it so users can merge, ownership of the DB is only granted on first login of a local user NOT the OIDC user. Even if the first-time-creation supplies OIDC only, with no local user specified, that user will not be granted full admin (or any type of admin at all). In this case, the DB will be ownerless and the OIDC user would not be able to make any administrative changes. The DB would have no admin either since admin transfer code only works if there is an existing admin. For the DB to assign a first-time admin, the first time user (whether its a local user or oidc doesnt mater) needs to have the is_owner flag as well as is_admin.

The code lists the following lines: local user path:

user_count = cur.fetchone()[0] is_admin = user_count == 0 is_owner = user_count == 0

INSERT INTO users (..., is_admin, is_owner)

oidc user path

is_admin = admin_oidc_group in user_groups

INSERT INTO users ( username, email, first_name, last_name, is_admin, oidc_sub, oidc_issuer, is_active )

luci-serendipity avatar Sep 15 '26 15:09 luci-serendipity

Closing this as not planned. Automatically linking an existing local account to an SSO identity is risky: if the identity provider account is ever compromised, or an email address is reused, the linked Warracker account goes with it. The safe paths already exist: sign in with OIDC from the start, or have an admin manage accounts in the Users panel. Thanks for the suggestion.

sassanix avatar Nov 01 '26 15:11 sassanix

Reopening this under consideration, with a wider scope than the original request, following discussion in the Discord support channel on Nov 2 and 3, 2026.

What was closed here was automatic linking on an email match alone. That stays ruled out. What is now under consideration is confirmed linking:

  • An opt-in site setting enables linking, off by default.
  • On an email conflict, the pending provider subject and issuer are held server side, short lived and single use, and the user is taken to a confirmation step instead of the current dead end.
  • The link is only written after the user proves ownership of the existing account by entering its password. The OIDC session proves control of the provider account, the password proves control of the Warracker account.
  • The confirmation screen names the provider and the identity being attached, and the link is written to the audit log.
  • One provider identity per account, and an identity already attached to another account cannot be linked again.

Provider replacement is in scope in the same design (raised by Mattevil in the Discord support channel): attach or replace the identity on an existing account covers switching providers, for example moving off one provider to a new one, as well as local to OIDC linking. His case has an extra edge: the old provider had already been removed, so the old identity cannot be proved by signing in with it. That path needs the password check, or an admin reset of the identity in the Users panel.

Target is after 1.0.5, which is feature complete. No commitment on timing.

sassanix avatar Nov 03 '26 13:11 sassanix