Граф коммитов

6 Коммитов

Автор SHA1 Сообщение Дата
jake a61c54713b Bug 1780215 - Use arc4random_buf within GenerateRandomBytesFromOS when compiling to wasi r=jandem
wasi-libc provides arc4random methods - 7a21011e98/libc-top-half/musl/include/stdlib.h (L205-L213)

Without this change, js::GenerateRandomSeed will fallback to using a timestamp for the random seed (https://searchfox.org/mozilla-central/rev/3e1a721bce1da3ae04675539b39a4e95b25a046d/js/src/jsmath.cpp#491-494) which is used as both seed values within the PRNG(https://searchfox.org/mozilla-central/rev/3e1a721bce1da3ae04675539b39a4e95b25a046d/js/src/jsmath.cpp#501-502) - having the same value for both seeds seems to cause the first two PRNG calls to produce the same first 4 decimal places.

This change stops the timestamp fallback from being used when compiling to wasm/wasi which avoids this issue.

Differential Revision: https://phabricator.services.mozilla.com/D152180
2022-07-20 13:17:54 +00:00
Chris Peterson 3846a747b0 Bug 1723674 - mfbt: Add new GenerateRandomBytes() function. r=cmartin
Generalize RandomUint64() into a new GenerateRandomBytes() function, which will be used in the next changeset to replace nsUUIDGenerator's various platform-specific implementations with one simple implementation.

Differential Revision: https://phabricator.services.mozilla.com/D124311
2021-10-14 03:28:48 +00:00
Alex Catarineu bc96439261 Bug 461204 - Improve the random number generator for the boundaries in multipart/form-data r=smaug
Using a weak RNG for the form boundary allows a website operator to perform several
attacks on users (as outlined in https://trac.torproject.org/projects/tor/ticket/22919)

These include:
 - Identifying Windows users based on the unseeded RNG
 - Identify the number of form submissions that have occurred cross-origin between same-origin submissions

Additionally, a predictable boundary makes it possible to forge a boundary in the middle
of a file upload.

Differential Revision: https://phabricator.services.mozilla.com/D56056

--HG--
extra : moz-landing-system : lando
2020-01-13 20:41:14 +00:00
Ehsan Akhgari e5e885ae31 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
# ignore-this-changeset

--HG--
extra : amend_source : 7221c8d15a765df71171099468e7c7faa648f37c
extra : histedit_source : a0cce6015636202bff09e35a13f72e03257a7695
2019-01-18 10:16:18 +01:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Chris Martin 6f57bf69b4 Bug 1402282 - Move CSPRNG logic to common area r=froydnj
The logic in JSMath for generating cryptographically-secure
pseudorandom numbers without NSS is independently useful, and so
it's been moved to a common area.

It will eventually be used for generated random arena ids.

Differential Revision: https://phabricator.services.mozilla.com/D8597

--HG--
extra : moz-landing-system : lando
2018-10-25 18:00:15 +00:00