fix!: deprecate login_type=none, convert existing users to password login - #26851
Conversation
| -- `prebuilds@system` user should not convert it to service account. | ||
| AND is_system = false; |
There was a problem hiding this comment.
This is defensive programming. Things would theoretically continue working if this was a service account, however, we don't want to allow it access to HTTP API key creation AI Bridge auth and Notifications.
login_type=none to service accounts
…l-services-accounts-all-the-time
login_type=none to service accountslogin_type=none, convert existing users to password login
Documentation CheckUpdates Needed
Note The migration has been renumbered across rebases onto Automated review via Coder Agents |
| @@ -0,0 +1,9 @@ | |||
| -- Convert legacy users created with login_type 'none' to password auth. | |||
| -- OSS deployments cannot create service accounts without Premium. Existing | |||
There was a problem hiding this comment.
I see that we convert to password to avoid losing the email but why is that important? It seems to me like converting these to system accounts would be a seamless transition; do admins actually care if these types of users have emails?
At least, for premium users it would be seamless. For non-premium users I am not sure what happens if you have service accounts. Is the problem that we only prevent creating the accounts so a non-premium user would be grandfathered into keeping these service accounts? To me that seems reasonable though, and definitely less bad than a breaking change forcing premium users to recreate their accounts.
(I read through this description and the other PR; apologies if I missed some discussion.)
There was a problem hiding this comment.
I see that we convert to password to avoid losing the email but why is that important? It seems to me like converting these to system accounts would be a seamless transition; do admins actually care if these types of users have emails?
These are not internal coder system accounts, I'm not sure we should blur the line between is_system here.
At least, for premium users it would be seamless. For non-premium users I am not sure what happens if you have service accounts. Is the problem that we only prevent creating the accounts so a non-premium user would be grandfathered into keeping these service accounts?
This was a product decision, we did discuss handing out Service Accounts being grandfathered in but if license enforcement changes in the future we could possibly breaking OSS instances.
There will be product discussion sent out to customers about the migration path here.
There was a problem hiding this comment.
Ooops sorry I meant service accounts, not system accounts 🤦
Gotcha if this was the product decision then so be it 😄
There was a problem hiding this comment.
fwiw though since we are already breaking both oss and premium instances with this change, seems less worse to break only oss instances later down the line instead 🤷
There was a problem hiding this comment.
@code-asher yeah that was essentially the choice. Having service accounts in OSS is not great because we are introducing an account into OSS that they can't actually get more of (service accounts are premium).
…l-services-accounts-all-the-time
| req.UserLoginType = codersdk.LoginTypePassword | ||
| } | ||
|
|
||
| if !req.ServiceAccount && req.UserLoginType == codersdk.LoginTypeNone { |
There was a problem hiding this comment.
nbd at all but this could be an else and skip the duplicate req.ServiceAccount check.
| @@ -0,0 +1,9 @@ | |||
| -- Convert legacy users created with login_type 'none' to password auth. | |||
| -- OSS deployments cannot create service accounts without Premium. Existing | |||
There was a problem hiding this comment.
@code-asher yeah that was essentially the choice. Having service accounts in OSS is not great because we are introducing an account into OSS that they can't actually get more of (service accounts are premium).
Deprecates
login_type=none(legacy passwordless machine users) in favour of premium service accounts, and migrates existing accounts off the deprecated path while preserving their identity. Resolves DEVEX-226.What this does
POST /usersandcoder users createrejectlogin_type=none(and the deprecated--disable-login) unless a service account is requested.000554_legacy_none_login_to_passwordrewrites legacy non-system, non–service-accountlogin_type='none'accounts tologin_type='password'. Email addresses are preserved and existing API tokens remain valid. Admins can set a password if interactive login is desired.Why convert to
passwordand notis_service_account?Migration
000433_add_is_service_account_to_usersadds two CHECK constraints:users_email_not_empty:(is_service_account = true) = (email = '')users_service_account_login_type:is_service_account = false OR login_type = 'none'Turning a real, email-bearing
login_type=noneuser into a service account would require blanking their email. Converting topasswordinstead preserves the account and its email.Decision log
login_type=noneusers off the deprecated path while preserving their identity/email.is_service_accountCHECK constraints (migration000433) make a literalnone → service accountconversion require blanking emails, so this PR converts topasswordinstead to keep emails intact.cli/usercreate.goandcoderd/users.go, matching test updates, plus the000554_legacy_none_login_to_password.{up,down}.sqlmigration.mainand its migration originally numbered000534, which collided with main's000534_drop_chat_model_configs_provider. Mergedmainand renumbered to000554(next free after main's000553).make genproduces no drift (the migration is data-only).