Repository navigation
chore: gate Django debug toolbar behind DEBUG env in local settings - #9880
Conversation
Port of makeplane/plane-ee#7664. Local settings now read DEBUG from the environment (default on) and only load debug_toolbar when DEBUG is enabled, so DEBUG=0 skips its per-request SQL/panel overhead.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughLocal settings now read ChangesLocal debug settings
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~5 minutes Change: Other Merge Risk: ⚪ Minimal · up to The change is mergeable based on the supplied evidence: local debug remains enabled when DEBUG is unset, and setting DEBUG=0 opts out of debug and the toolbar. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change lets local API operators turn off debug mode and the toolbar. It preserves the previous default and does not appear to add diagnostic exposure. Whether a local API is reachable beyond a developer machine depends on its deployment configuration. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Hardening Proposals
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Description
The Django debug toolbar was unconditionally loaded in
plane/settings/local.py, and its SQL panel captures a full Python stack trace for every query — even on JSON API responses where the toolbar UI never renders. On query-heavy endpoints this adds noticeable overhead to the local API.This PR makes local settings rely on the existing
DEBUGenv var instead of hardcodingDEBUG = True:local.pynow readsDEBUGfrom the environment (default1, so local setups behave as before)debug_toolbarapp, its middleware, andDEBUG_TOOLBAR_PATCH_SETTINGSonly whenDEBUGis onSetting
DEBUG=0in the API environment disables the toolbar and its per-request overhead (__debug__/routes inurls.pyare already gated onsettings.DEBUGand whether the app is installed). Only local development settings are affected; production settings are untouched.Type of Change
Screenshots and Media (if applicable)
Test Scenarios
DEBUGenv var set — toolbar loads as before (DEBUG=True, toolbar inINSTALLED_APPS/ middleware)DEBUG=0— toolbar app/middleware absent;DEBUG_TOOLBAR_PATCH_SETTINGSunsetpython manage.py check --settings=plane.settings.localpasses withDEBUGset to both0and1settings.DEBUG,INSTALLED_APPS, andMIDDLEWAREtoggle correctly with the env varReferences
N/A