The problem of course is that the secrets library in
3.6 uses os.urandom under the covers, so it’s security rests on
the security of os.urandom. To ensure that the secrets library
is actually safe even in early boot it’ll need to stop using
os.urandom on Linux and use the getrandom() function.
That same library exposes random.SystemRandom as
secrets.SystemRandom [1], and of course SystemRandom uses
os.urandom too. So if we want people to treat
secrets.SystemRandom as “always secure” then it would need to
stop using os.urandom and start using the get random() function
on Linux as well.
[1] This is actually documented as "using the
highest-quality sources provided by the operating system” in the
secrets documentation, and I’d argue that it is not using the
highest-quality source if it’s reading from /dev/urandom or
getrandom(GRD_NONBLOCK) on Linux systems where getrandom() is
available. Of course, it’s just an alias for
random.SystemRandom, and that is documented as using os.urandom.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/srkunze%40mail.de