Change use of random to random.SystemRandom
There's no reason to use random directly unless the code really requires a pseudo-random number generator. This is for security hardening. SecImpact Closes-Bug: 1424089 Change-Id: I2eb0c78af230026de9139363bc05e453d581a700
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
Keystone Memcached dogpile.cache backend implementation.
|
Keystone Memcached dogpile.cache backend implementation.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import random
|
import random as _random
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from dogpile.cache import api
|
from dogpile.cache import api
|
||||||
@@ -33,7 +33,7 @@ from keystone.i18n import _
|
|||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
NO_VALUE = api.NO_VALUE
|
NO_VALUE = api.NO_VALUE
|
||||||
|
random = _random.SystemRandom()
|
||||||
|
|
||||||
VALID_DOGPILE_BACKENDS = dict(
|
VALID_DOGPILE_BACKENDS = dict(
|
||||||
pylibmc=memcached.PylibmcBackend,
|
pylibmc=memcached.PylibmcBackend,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import random
|
import random as _random
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
@@ -26,6 +26,9 @@ from keystone import exception
|
|||||||
from keystone.i18n import _
|
from keystone.i18n import _
|
||||||
|
|
||||||
|
|
||||||
|
random = _random.SystemRandom()
|
||||||
|
|
||||||
|
|
||||||
class Consumer(sql.ModelBase, sql.DictBase):
|
class Consumer(sql.ModelBase, sql.DictBase):
|
||||||
__tablename__ = 'consumer'
|
__tablename__ = 'consumer'
|
||||||
attributes = ['id', 'description', 'secret']
|
attributes = ['id', 'description', 'secret']
|
||||||
|
|||||||
Reference in New Issue
Block a user