replace random with secrets#800
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #800 +/- ##
=======================================
Coverage 70.12% 70.12%
=======================================
Files 61 61
Lines 14001 14001
=======================================
Hits 9818 9818
Misses 4183 4183
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
The usage in the example you showed is indeed not something that has to be secret, it is more intended to be matched later. Anyway, I don't think it would hurt to improve it a bit, since there is this warning on the "random" page you shared:
And we don't know if future use wouldn't fall into using the |
OpenQA test summaryComplete test suite and dependencies: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2026042316-4.3&flavor=pull-requests Test run included the following:
New failures, excluding unstableCompared to: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2026032404-devel&flavor=update
Failed tests43 failures
Fixed failuresCompared to: https://openqa.qubes-os.org/tests/170766#dependencies 32 fixed
Unstable testsDetails
Performance TestsPerformance degradation:11 performance degradations
Remaining performance tests:100 tests
|
This PR replaces the
randommodule that uses an algorithm that is not a suitable CSPRNG (https://docs.python.org/3/library/random.html) with pythonssecretsmodule.The function
random_stringis called by the qubes admin api that generates a tokenqubes-core-admin/qubes/api/admin.py
Line 470 in 2488f2b
The change in zfs.py does not seem to have any security impact, but to prevent calling it in the future to generate values that are supposed to be secret i changed it along.