[tor-bugs] #33388 [Circumvention/BridgeDB]: Patch for #31967. Changed pseudo-random generator to random.SystemRandom.choice()

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Feb 20 00:50:06 UTC 2020


#33388: Patch for #31967. Changed pseudo-random generator to
random.SystemRandom.choice()
-------------------------------+----------------------------------------
 Reporter:  agix               |          Owner:  (none)
     Type:  enhancement        |         Status:  new
 Priority:  Medium             |      Component:  Circumvention/BridgeDB
  Version:  sbws: unspecified  |       Severity:  Normal
 Keywords:                     |  Actual Points:
Parent ID:                     |         Points:
 Reviewer:                     |        Sponsor:
-------------------------------+----------------------------------------
 From fc8b3c59d23b2cc637e4db5cd8385720027f59e0 Mon Sep 17 00:00:00 2001
 From: agix <columbeff at gmail.com>
 Date: Thu, 20 Feb 2020 01:24:24 +0100
 Subject: [PATCH] Fix for #31967. Changed pseudo-random generator to
  random.SystemRandom.choice()

 ---
  bridgedb/captcha.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/bridgedb/captcha.py b/bridgedb/captcha.py
 index b66972c..485974b 100644
 --- a/bridgedb/captcha.py
 +++ b/bridgedb/captcha.py
 @@ -386,7 +386,7 @@ class GimpCaptcha(Captcha):
              and a challenge string (used for checking the client's
 solution).
          """
          try:
 -            imageFilename = random.choice(os.listdir(self.cacheDir))
 +            imageFilename =
 random.SystemRandom().choice(os.listdir(self.cacheDir))
              imagePath = os.path.join(self.cacheDir, imageFilename)
              with open(imagePath) as imageFile:
                  self.image = imageFile.read()
 --
 2.17.1

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/33388>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list