Skip to content

fix: normalize OAuth provider config flags#9135

Open
KanteshMurade wants to merge 1 commit into
makeplane:previewfrom
KanteshMurade:fix-gitea-oauth-button
Open

fix: normalize OAuth provider config flags#9135
KanteshMurade wants to merge 1 commit into
makeplane:previewfrom
KanteshMurade:fix-gitea-oauth-button

Conversation

@KanteshMurade
Copy link
Copy Markdown
Contributor

@KanteshMurade KanteshMurade commented May 25, 2026

Description

Fixes the issue where OAuth providers such as Gitea were not rendered on the login page when self-hosted instances used boolean-like config values such as "true" instead of "1".

The issue occurred because OAuth provider flags were serialized using strict "1" comparisons.

This change normalizes OAuth provider config checks so values like:

  • "1"
  • "true"
  • "TRUE"
  • " true "

are treated as enabled.

The fix is scoped only to OAuth provider flags:

  • Google
  • GitHub
  • GitLab
  • Gitea

Closes #9124

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Test Scenarios

  • Verified Python compilation passes
  • Verified "1" resolves to enabled
  • Verified "true" resolves to enabled
  • Verified "0" and "false" remain disabled
  • Confirmed change is limited to OAuth provider serialization logic

References

Issue: #9124

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced configuration parsing for authentication integrations (Google, GitHub, GitLab, Gitea) to recognize multiple input formats when enabling these providers, improving flexibility in instance configuration.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2026

📝 Walkthrough

Walkthrough

A helper function normalizes OAuth provider configuration values by trimming, lowercasing, and accepting "1" or "true" as enabled. Four OAuth provider enablement flags in instance configuration parsing are updated to use this flexible normalization instead of strict string equality.

Changes

Configuration Parsing Enhancement

Layer / File(s) Summary
Configuration value normalization helper
apps/api/plane/license/api/views/instance.py
New _is_config_enabled(value) utility converts configuration values to lowercase, trims whitespace, and treats "1" and "true" as enabled.
OAuth provider configuration parsing
apps/api/plane/license/api/views/instance.py
Instance configuration parsing for Google, GitHub, GitLab, and Gitea enabled flags replaces strict "== '1'" checks with _is_config_enabled(...) calls.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A helper hops in to normalize the way,
Configuration values find their say,
"1" and "true" now dance as one,
Flexible parsing, cleanly done!
OAuth providers rejoice and play. 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive The PR claims to close #9124, but linked issue describes a sub-task expansion UI problem unrelated to OAuth provider config normalization. Verify the correct issue number is referenced; the PR changes appear to fix OAuth config normalization, not sub-task expansion behavior.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: normalizing OAuth provider config flags to accept multiple boolean-like formats.
Description check ✅ Passed The description comprehensively covers the bug being fixed, the root cause, the implementation approach, scope limitations, and test verification.
Out of Scope Changes check ✅ Passed All changes are scoped to OAuth provider config normalization in instance.py; no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
apps/api/plane/license/api/views/instance.py (1)

134-135: ⚡ Quick win

Consider applying the same normalization to other boolean configuration values.

For consistency and robustness, the same flexible boolean normalization could be applied to ENABLE_SIGNUP, DISABLE_WORKSPACE_CREATION, ENABLE_MAGIC_LINK_LOGIN, and ENABLE_EMAIL_PASSWORD. These flags currently use strict == "1" comparisons, which means they would face the same issue if configured with boolean-like strings such as "true".

♻️ Proposed consistency improvement
-        data["enable_signup"] = ENABLE_SIGNUP == "1"
-        data["is_workspace_creation_disabled"] = DISABLE_WORKSPACE_CREATION == "1"
+        data["enable_signup"] = _is_config_enabled(ENABLE_SIGNUP)
+        data["is_workspace_creation_disabled"] = _is_config_enabled(DISABLE_WORKSPACE_CREATION)
         data["is_google_enabled"] = _is_config_enabled(IS_GOOGLE_ENABLED)
         data["is_github_enabled"] = _is_config_enabled(IS_GITHUB_ENABLED)
         data["is_gitlab_enabled"] = _is_config_enabled(IS_GITLAB_ENABLED)
         data["is_gitea_enabled"] = _is_config_enabled(IS_GITEA_ENABLED)
-        data["is_magic_login_enabled"] = ENABLE_MAGIC_LINK_LOGIN == "1"
-        data["is_email_password_enabled"] = ENABLE_EMAIL_PASSWORD == "1"
+        data["is_magic_login_enabled"] = _is_config_enabled(ENABLE_MAGIC_LINK_LOGIN)
+        data["is_email_password_enabled"] = _is_config_enabled(ENABLE_EMAIL_PASSWORD)

Also applies to: 140-141

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/api/plane/license/api/views/instance.py` around lines 134 - 135, Create/
reuse a boolean-normalization helper (e.g., normalize_bool(value)) and replace
the strict == "1" checks for the flags ENABLE_SIGNUP,
DISABLE_WORKSPACE_CREATION, ENABLE_MAGIC_LINK_LOGIN, and ENABLE_EMAIL_PASSWORD
so the view uses normalized booleans when populating data["enable_signup"],
data["is_workspace_creation_disabled"], data["enable_magic_link_login"], and
data["enable_email_password"]; locate these variables in the instance view
(functions referencing ENABLE_SIGNUP, DISABLE_WORKSPACE_CREATION,
ENABLE_MAGIC_LINK_LOGIN, ENABLE_EMAIL_PASSWORD) and call normalize_bool(...) on
each config value before assigning to the data dict.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/api/plane/license/api/views/instance.py`:
- Around line 134-135: Create/ reuse a boolean-normalization helper (e.g.,
normalize_bool(value)) and replace the strict == "1" checks for the flags
ENABLE_SIGNUP, DISABLE_WORKSPACE_CREATION, ENABLE_MAGIC_LINK_LOGIN, and
ENABLE_EMAIL_PASSWORD so the view uses normalized booleans when populating
data["enable_signup"], data["is_workspace_creation_disabled"],
data["enable_magic_link_login"], and data["enable_email_password"]; locate these
variables in the instance view (functions referencing ENABLE_SIGNUP,
DISABLE_WORKSPACE_CREATION, ENABLE_MAGIC_LINK_LOGIN, ENABLE_EMAIL_PASSWORD) and
call normalize_bool(...) on each config value before assigning to the data dict.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b43dca59-07af-40e3-89c4-239ad8514b89

📥 Commits

Reviewing files that changed from the base of the PR and between e71a8f5 and 919e709.

📒 Files selected for processing (1)
  • apps/api/plane/license/api/views/instance.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: Collapsible sub-tasks require three clicks to expand

1 participant