-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Description
The configure_instance management command uses an all-or-nothing check when seeding OAuth IS_*_ENABLED flags. Because IS_GITEA_ENABLED is already seeded by instance_config_variables in the first loop of the command, the exists() check on line 44 always returns True, and IS_GITHUB_ENABLED, IS_GOOGLE_ENABLED, and IS_GITLAB_ENABLED are never created in the database.
Root cause
keys = ["IS_GOOGLE_ENABLED", "IS_GITHUB_ENABLED", "IS_GITLAB_ENABLED", "IS_GITEA_ENABLED"]
if not InstanceConfiguration.objects.filter(key__in=keys).exists():
# create all four ...
else:
for key in keys:
self.stdout.write(self.style.WARNING(f"{key} configuration already exists"))IS_GITEA_ENABLED is defined in gitea_config_variables (in instance_config_variables) and gets seeded by the get_or_create loop earlier in handle(). So filter(key__in=keys).exists() is always True, and the else branch runs — printing "already exists" for all four keys even though three of them don't exist.
Consequence
When an admin configures GitHub/Google/GitLab OAuth in God Mode and toggles the provider on:
- The frontend PATCHes
/api/instances/configurations/with{"IS_GITHUB_ENABLED": "1"} - The backend does
InstanceConfiguration.objects.filter(key__in=request.data.keys())which returns an empty queryset (the row doesn't exist) bulk_updateupdates zero rows- The endpoint returns 200 OK with an empty list — no error
- The toggle appears to succeed but reverts on page reload
- The provider never shows up on the login page
Steps to reproduce
- Self-host Plane v1.2.3 (fresh install, no OAuth env vars)
- Go to God Mode → Authentication → GitHub → Configure
- Enter valid GitHub OAuth Client ID and Client Secret, save
- Go back to Authentication page, toggle GitHub on
- Toggle appears to enable but reverts on refresh
- GitHub login button never appears on the login page
Expected behavior
Each IS_*_ENABLED flag should be seeded independently so that the existence of one doesn't prevent creation of the others.
Environment
- Plane version: v1.2.3 (also present on current
previewbranch) - Deployment: Self-hosted Docker Compose