Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
bug: Invalidate UAIDs that are not lowercase or contain dashes
Browse files Browse the repository at this point in the history
Older UAIDs contain invalid characters and should be rejected.

Closes #519
  • Loading branch information
jrconlin committed Jul 15, 2016
1 parent 7bbb7dd commit 265d768
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 55 deletions.
1 change: 1 addition & 0 deletions autopush/tests/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def test_hasher(self):
db.key_hash = ""

def test_normalize_id(self):
# Note, yes, we forbid dashes in UAIDs, and we add them here.
import autopush.db as db
abnormal = "deadbeef00000000decafbad00000000"
normal = "deadbeef-0000-0000-deca-fbad00000000"
Expand Down
4 changes: 2 additions & 2 deletions autopush/tests/test_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
from autopush.utils import (generate_hash, decipher_public_key)

mock_dynamodb2 = mock_dynamodb2()
dummy_uaid = str(uuid.UUID("abad1dea00000000aabbccdd00000000"))
dummy_chid = str(uuid.UUID("deadbeef00000000decafbad00000000"))
dummy_uaid = uuid.UUID("abad1dea00000000aabbccdd00000000").hex
dummy_chid = str(uuid.UUID("deadbeef-0000-0000-deca-fbad00000000"))
dummy_token = dummy_uaid + ":" + dummy_chid


Expand Down
2 changes: 1 addition & 1 deletion autopush/tests/test_web_webpush.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from autopush.router.interface import IRouter, RouterResponse
from autopush.settings import AutopushSettings

dummy_request_id = "11111111-1234-1234-1234-567812345678"
dummy_request_id = "11111111123412341234567812345678"
dummy_uaid = str(uuid.UUID("abad1dea00000000aabbccdd00000000"))
dummy_chid = str(uuid.UUID("deadbeef00000000decafbad00000000"))
dummy_token = dummy_uaid + ":" + dummy_chid
Expand Down
Loading

0 comments on commit 265d768

Please sign in to comment.