Skip to content

Incorrect series validation regex #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions tempodb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -129,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)
Expand All @@ -150,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)
Expand Down
3 changes: 0 additions & 3 deletions tests/client/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down