comparison roundup/roundupdb.py @ 5350:66a17c80e035

Force all uses of random to use SystemRandom and abort if pseudorandom random.Random would be used rather than Random.SystemRandom. random.Random is returning the same value time after time. Even when being seeded after instantiation, calls to the random.random() function return the same value like it's not advanceing the state of the generator. So "fix" is to force use of system random generator to generate: one time keys for password reset (action.py) random passwords when resetting passwords (password.py) serial number for auto ssl cert generation (roundup_server.py) Message-ID's in email: mailgw.py, client.py anti-csrf nonces (templating.py)
author John Rouillard <rouilj@ieee.org>
date Sat, 07 Jul 2018 22:02:41 -0400
parents 62de601bdf6f
children 91954be46a66
comparison
equal deleted inserted replaced
5349:b11bc7c77d09 5350:66a17c80e035
18 18
19 """Extending hyperdb with types specific to issue-tracking. 19 """Extending hyperdb with types specific to issue-tracking.
20 """ 20 """
21 __docformat__ = 'restructuredtext' 21 __docformat__ = 'restructuredtext'
22 22
23 import re, os, smtplib, socket, time, random 23 import re, os, smtplib, socket, time
24
25 try:
26 # Use the cryptographic source of randomness if available
27 from random import SystemRandom
28 random=SystemRandom()
29 except ImportError:
30 raise
31 from random import Random
32 random=Random()
33
24 import cStringIO, base64, mimetypes 34 import cStringIO, base64, mimetypes
25 import os.path 35 import os.path
26 import logging 36 import logging
27 from email import Encoders 37 from email import Encoders
28 from email.parser import FeedParser 38 from email.parser import FeedParser

Roundup Issue Tracker: http://roundup-tracker.org/