fix: strip whitespace from instance configuration values#8744
fix: strip whitespace from instance configuration values#8744okxint wants to merge 1 commit intomakeplane:previewfrom
Conversation
|
|
📝 WalkthroughWalkthroughThe instance configuration endpoint now strips leading and trailing whitespace from configuration values before persisting them to the database. This prevents accidental whitespace in pasted credentials (e.g., OAuth Client IDs) from being stored verbatim. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
apps/api/plane/license/api/views/configuration.py
| bulk_configurations = [] | ||
| for configuration in configurations: | ||
| value = request.data.get(configuration.key, configuration.value) | ||
| value = str(request.data.get(configuration.key, configuration.value)).strip() |
There was a problem hiding this comment.
Handle null explicitly before stringifying.
str(...).strip() turns a JSON null clear request into the literal "None". Since get_configuration_value() reads persisted values back verbatim, that string will propagate into runtime config instead of behaving like an empty/unset value.
Suggested fix
- value = str(request.data.get(configuration.key, configuration.value)).strip()
+ raw_value = request.data.get(configuration.key, configuration.value)
+ value = "" if raw_value is None else str(raw_value).strip()📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| value = str(request.data.get(configuration.key, configuration.value)).strip() | |
| raw_value = request.data.get(configuration.key, configuration.value) | |
| value = "" if raw_value is None else str(raw_value).strip() |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/api/plane/license/api/views/configuration.py` at 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.
|
Hey, friendly follow-up on this — let me know if there's anything I should adjust. Happy to iterate on feedback! |
Strip whitespace from config values before persisting. Closes #8737
Summary by CodeRabbit