From f0d0ddbada065ec0ff4fc64aed9d2f9ba48ba5a3 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Fri, 15 Nov 2013 22:25:33 +0100 Subject: Switch to random storage ids to avoid exposing information. --- debug_toolbar/toolbar.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'debug_toolbar/toolbar.py') diff --git a/debug_toolbar/toolbar.py b/debug_toolbar/toolbar.py index 992e4a8..acb86d9 100644 --- a/debug_toolbar/toolbar.py +++ b/debug_toolbar/toolbar.py @@ -4,6 +4,8 @@ The main DebugToolbar class that loads and renders the Toolbar. from __future__ import unicode_literals +import uuid + from django.conf import settings from django.conf.urls import patterns, url from django.core.exceptions import ImproperlyConfigured @@ -62,7 +64,6 @@ class DebugToolbar(object): # Handle storing toolbars in memory and fetching them later on - _counter = 0 _storage = SortedDict() def should_render_panels(self): @@ -72,14 +73,14 @@ class DebugToolbar(object): return render_panels def store(self): + storage_id = uuid.uuid4().hex cls = type(self) - cls._counter += 1 - cls._storage[cls._counter] = self + cls._storage[storage_id] = self for _ in range(len(cls._storage) - dt_settings.CONFIG['RESULTS_CACHE_SIZE']): # When we drop support for Python 2.6 and switch to # collections.OrderedDict, use popitem(last=False). del cls._storage[cls._storage.keyOrder[0]] - return cls._counter + return storage_id @classmethod def fetch(cls, storage_id): -- cgit v1.2.3