Skip to content

Commit 4e6ef19

Browse files
committed
changing the sid after checking for collisions defeats the purpose
1 parent aff1b2e commit 4e6ef19

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

roundup/cgi/client.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,16 +185,10 @@ def __init__(self, client):
185185
def _gen_sid(self):
186186
""" generate a unique session key """
187187
while 1:
188-
s = b2s(binascii.b2a_base64(random_.token_bytes(32)).strip())
188+
s = b2s(binascii.b2a_base64(random_.token_bytes(32)).strip()).rstrip('=')
189189
if not self.session_db.exists(s):
190190
break
191191

192-
# clean up the base64
193-
if s[-1] == '=':
194-
if s[-2] == '=':
195-
s = s[:-2]
196-
else:
197-
s = s[:-1]
198192
return s
199193

200194
def clean_up(self):

0 commit comments

Comments
 (0)