core: fix bandit issues

This commit is contained in:
Jens Langhammer 2018-12-09 21:20:34 +01:00
parent bc691f4f4c
commit 57f01952bd
No known key found for this signature in database
GPG key ID: BEBC05297D92821B

View file

@ -1,7 +1,7 @@
"""passbook core models""" """passbook core models"""
import re import re
from logging import getLogger from logging import getLogger
from random import randrange from random import SystemRandom
from time import sleep from time import sleep
from uuid import uuid4 from uuid import uuid4
@ -230,7 +230,7 @@ class DebugRule(Rule):
def passes(self, user: User): def passes(self, user: User):
"""Wait random time then return result""" """Wait random time then return result"""
wait = randrange(self.wait_min, self.wait_max) wait = SystemRandom().randrange(self.wait_min, self.wait_max)
LOGGER.debug("Rule '%s' waiting for %ds", self.name, wait) LOGGER.debug("Rule '%s' waiting for %ds", self.name, wait)
sleep(wait) sleep(wait)
return self.result return self.result