You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In src/oic/__init__.py, random.SystemRandom is imported via the following code:
try:
import random.SystemRandom as rnd
except ImportError:
import random as rnd
In both python2 and python3 this yields an import error and falls back to the random package.
I believe the fix is to change the import to from random import SystemRandom as rnd. The import works locally for me but I am having some trouble with the unit tests and wanted to check in before opening a pull request.
The text was updated successfully, but these errors were encountered:
* Fix randomness for rndstr() and unreserved()
The import for SystemRandom was broken, so rndstr() got its randomness from the non-CSPRNG random.Random().
We now use secrets.choice() when available, otherwise fallback to SystemRandom and warn if only the Mersenne-Twister based random.Random() is available.
It is probably a good idea to migrate to secrets.token_* APIs for rndstr() and unreserved() in the future.
Close#486
andrewkrug
pushed a commit
to mozilla-iam/pyoidc
that referenced
this issue
Jun 6, 2019
* Fix randomness for rndstr() and unreserved()
The import for SystemRandom was broken, so rndstr() got its randomness from the non-CSPRNG random.Random().
We now use secrets.choice() when available, otherwise fallback to SystemRandom and warn if only the Mersenne-Twister based random.Random() is available.
It is probably a good idea to migrate to secrets.token_* APIs for rndstr() and unreserved() in the future.
CloseCZ-NIC#486
In
src/oic/__init__.py
,random.SystemRandom
is imported via the following code:In both python2 and python3 this yields an import error and falls back to the
random
package.I believe the fix is to change the import to
from random import SystemRandom as rnd
. The import works locally for me but I am having some trouble with the unit tests and wanted to check in before opening a pull request.The text was updated successfully, but these errors were encountered: