Skip to content

fix: strip whitespace from instance configuration values#8744

Open
okxint wants to merge 1 commit intomakeplane:previewfrom
okxint:fix/strip-whitespace-instance-config
Open

fix: strip whitespace from instance configuration values#8744
okxint wants to merge 1 commit intomakeplane:previewfrom
okxint:fix/strip-whitespace-instance-config

Conversation

@okxint
Copy link

@okxint okxint commented Mar 10, 2026

Strip whitespace from config values before persisting. Closes #8737

Summary by CodeRabbit

  • Bug Fixes
    • Configuration values are now normalized before saving: missing values become empty strings, inputs are trimmed of surrounding whitespace, and non-null values are coerced to strings prior to storage/encryption. This ensures more consistent processing and storage of configuration entries and reduces unexpected formatting issues.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e718e3b8-5d9d-4f4b-b75c-7646b4dbd369

📥 Commits

Reviewing files that changed from the base of the PR and between 91f8ea2 and 83640d8.

📒 Files selected for processing (1)
  • apps/api/plane/license/api/views/configuration.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/api/plane/license/api/views/configuration.py

📝 Walkthrough

Walkthrough

InstanceConfigurationEndpoint.patch now reads raw request values, coerces missing/None to an empty string, converts non-None values to stripped strings (removing leading/trailing whitespace) before applying encryption or saving them.

Changes

Cohort / File(s) Summary
Configuration Value Normalization
apps/api/plane/license/api/views/configuration.py
Changed InstanceConfigurationEndpoint.patch to: retrieve raw value, coerce None to "", convert non-None values to str(...).strip() before encryption or assignment; existing bulk update and response flow unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

I nibble at stray trailing space,
Pulling it out with gentle grace.
Keys now clean, no redirects fail,
OAuth hops along the trail. 🐇✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete; it lacks required sections from the template including Type of Change, Test Scenarios, and detailed description of the changes. Expand the description to include Type of Change (e.g., Bug fix), Test Scenarios detailing how the whitespace stripping was verified, and a more detailed explanation of the implementation.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: strip whitespace from instance configuration values' is clear, concise, and directly summarizes the main change in the pull request.
Linked Issues check ✅ Passed The code changes directly address the root cause identified in issue #8737 by stripping whitespace from configuration values before persisting them, resolving the OAuth redirect URL encoding issue.
Out of Scope Changes check ✅ Passed The changes are narrowly scoped to the InstanceConfigurationEndpoint.patch method and focus solely on normalizing input values by stripping whitespace, which is directly in scope with the linked issue #8737.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

You can get early access to new features in CodeRabbit.

Enable the early_access setting to enable early access features such as new models, tools, and more.

Copy link
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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/api/plane/license/api/views/configuration.py`:
- Line 48: When building the new config value, don't call str(...) on a JSON
null; instead read the raw = request.data.get(configuration.key,
configuration.value) and if raw is None set value to an empty string (or other
empty/unset sentinel) before calling .strip(); this prevents JSON null from
becoming the literal "None" in persisted config and aligns with
get_configuration_value() semantics. Ensure you update the assignment around
request.data.get(configuration.key, configuration.value) (referenced by
configuration.key and configuration.value) to handle raw is None explicitly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e07f9fde-d22f-4ff3-bd46-379d4b142a8e

📥 Commits

Reviewing files that changed from the base of the PR and between 6627282 and 91f8ea2.

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

@okxint
Copy link
Author

okxint commented Mar 12, 2026

Hey, friendly follow-up on this — let me know if there's anything I should adjust. Happy to iterate on feedback!

When patching instance configuration values, the raw values from
request.data were used directly without sanitization. This adds:
- Whitespace stripping via str().strip() to prevent leading/trailing
  spaces from being stored
- Explicit None handling so that null values become empty strings
  instead of the literal string "None"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@okxint okxint force-pushed the fix/strip-whitespace-instance-config branch from 91f8ea2 to 83640d8 Compare March 16, 2026 10:20
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: OAuth login fails when instance configuration values have trailing whitespace

2 participants