playfire / django-debug-toolbar-user-panel

Panel for the Django Debug toolbar to quickly switch between users
http://code.playfire.com/django-debug-toolbar-user-panel/
BSD 3-Clause "New" or "Revised" License
81 stars 31 forks source link

Security issue if INSTALLED in production even with DEBUG=False #10

Closed sssbox closed 12 years ago

sssbox commented 12 years ago

The login function has no security to protect people viewing a production site from manually POSTing to /users/login/1 if you don't entirely disable the plugin by having overridden or different settings between dev and prod (probably a good idea, but easy to overlook by assuming "if DjDT doesn't show up the panels are probably all disabled").

Example of this error:

Solution: Easiest is to add from django.conf import settings to the top and if not settings.DEBUG: return HttpResponseBadRequest() right under line 42

Other somewhat unsafe ideas:

lamby commented 12 years ago

Pushed a fix; could you have a look? Many many thanks for reporting :)

I think this happened because I tend to conditionally include(...) the Debug Toolbar URLs when DEBUG=True due to some unrelated messing around with urls.py so I never really thought it was an issue.

sssbox commented 12 years ago

Yup, that works!

And I doubt it's something anyone would ever exploit but it's a pretty easy fix to be able to not worry about someone getting hacked should this become a more commonly used debug tool.