From 31133c2c5afa18b56ed6909e32826c2429d1a2e3 Mon Sep 17 00:00:00 2001 From: Leon Sasson Date: Mon, 16 Sep 2013 16:50:50 -0500 Subject: [PATCH 1/3] Incorrect series validation regex We allow for all UTF-8. All other clients have no regex validation either. --- tempodb/client.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tempodb/client.py b/tempodb/client.py index d5c41eb..7fdb45f 100644 --- a/tempodb/client.py +++ b/tempodb/client.py @@ -20,9 +20,6 @@ API_PORT = 443 API_VERSION = 'v1' -VALID_SERIES_KEY = r'^[a-zA-Z0-9\.:;\-_/\\ ]*$' -RE_VALID_SERIES_KEY = re.compile(VALID_SERIES_KEY) - class Client(object): @@ -62,8 +59,6 @@ def get_series(self, ids=[], keys=[], tags=[], attributes={}): return series def create_series(self, key=None): - if key and not RE_VALID_SERIES_KEY.match(key): - raise ValueError("Series key must match the following regex: %s" % (VALID_SERIES_KEY,)) params = {} if key is not None: From ef3cc1e4a9a2a4ce1c87fb1ca05b9da6f03067b1 Mon Sep 17 00:00:00 2001 From: Leon Sasson Date: Mon, 16 Sep 2013 16:53:42 -0500 Subject: [PATCH 2/3] No need to test for key validity --- tests/client/tests.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/client/tests.py b/tests/client/tests.py index 2f5f038..76fac20 100644 --- a/tests/client/tests.py +++ b/tests/client/tests.py @@ -100,9 +100,6 @@ def test_create_series(self): expected = Series('id', 'my-key.tag1.1', '', {}, ['my-key', 'tag1']) self.assertEqual(series, expected) - def test_create_series_validity_error(self): - with self.assertRaises(ValueError): - series = self.client.create_series('key.b%^.test') def test_update_series(self): update = Series('id', 'key', 'name', {'key1': 'value1'}, ['tag1']) From d5751f6a3ace5eb72946f06e27809a2c04d86b86 Mon Sep 17 00:00:00 2001 From: Leon Sasson Date: Tue, 17 Sep 2013 11:30:38 -0500 Subject: [PATCH 3/3] Removed regex validator from increment and write --- tempodb/client.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tempodb/client.py b/tempodb/client.py index 7fdb45f..a599bb4 100644 --- a/tempodb/client.py +++ b/tempodb/client.py @@ -124,9 +124,6 @@ def write_id(self, series_id, data): return self._write(series_type, series_val, data) def write_key(self, series_key, data): - if series_key and not RE_VALID_SERIES_KEY.match(series_key): - raise ValueError("Series key must match the following regex: %s" % (VALID_SERIES_KEY,)) - series_type = 'key' series_val = series_key return self._write(series_type, series_val, data) @@ -145,9 +142,6 @@ def increment_id(self, series_id, data): return self._increment(series_type, series_val, data) def increment_key(self, series_key, data): - if series_key and not RE_VALID_SERIES_KEY.match(series_key): - raise ValueError("Series key must match the following regex: %s" % (VALID_SERIES_KEY,)) - series_type = 'key' series_val = series_key return self._increment(series_type, series_val, data)