makeplane / makeplane/plane

🐛 Bug: OAuth provider toggles (GitHub, Google, GitLab) silently fail because IS_*_ENABLED rows are never seeded

Open
#8,739 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
59.6k
Forks
5.8k
Avg merge
1d 22h
Merged PRs (30d)
49

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:

  1. The frontend PATCHes /api/instances/configurations/ with {"IS_GITHUB_ENABLED": "1"}
  2. The backend does InstanceConfiguration.objects.filter(key__in=request.data.keys()) which returns an empty queryset (the row doesn't exist)
  3. bulk_update updates zero rows
  4. The endpoint returns 200 OK with an empty list — no error
  5. The toggle appears to succeed but reverts on page reload
  6. The provider never shows up on the login page

Steps to reproduce

  1. Self-host Plane v1.2.3 (fresh install, no OAuth env vars)
  2. Go to God Mode → Authentication → GitHub → Configure
  3. Enter valid GitHub OAuth Client ID and Client Secret, save
  4. Go back to Authentication page, toggle GitHub on
  5. Toggle appears to enable but reverts on refresh
  6. 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 preview branch)
  • Deployment: Self-hosted Docker Compose

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the configure_instance management command and inspect the OAuth IS_*_ENABLED seeding logic around line 44 and the earlier instance_config_variables loop. Reproduce the fresh-install configuration flow, then verify that each provider flag is stored independently and that enabling a provider persists after refreshing the Authentication page.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
authentication, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.