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
Copy file name to clipboardexpand all lines: SECURITY.md
+47-39
Original file line number
Diff line number
Diff line change
@@ -10,12 +10,24 @@ security.
10
10
### Marker traits
11
11
12
12
Rand provides the marker traits `CryptoRng`, `TryCryptoRng` and
13
-
`CryptoBlockRng`. Generators implementing one of these traits and used in a way
14
-
which meets the following additional constraints:
15
-
16
-
- Instances of seedable RNGs (those implementing `SeedableRng`) are
17
-
constructed with cryptographically secure seed values
18
-
- The state (memory) of the RNG and its seed value are not exposed
13
+
`CryptoBlockRng`. Generators (RNGs) implementing one of these traits which are
14
+
used according to these additional constraints:
15
+
16
+
- The generator may be constructed using `std::default::Default` where the
17
+
generator supports this trait. Note that generators should *only* support
18
+
`Default` where the `default()` instance is appropriately seeded: for
19
+
example `OsRng` has no state and thus has a trivial `default()` instance
20
+
while `ThreadRng::default()` returns a handle to a thread-local instance
21
+
seeded using `OsRng`.
22
+
- The generator may be constructed using `rand_core::SeedableRng` in any of
23
+
the following ways where the generator supports this trait:
24
+
25
+
- Via `SeedableRng::from_seed` using a cryptographically secure seed value
26
+
- Via `SeedableRng::from_rng` or `try_from_rng` using a cryptographically
27
+
secure source `rng`
28
+
- Via `SeedableRng::from_os_rng` or `try_from_os_rng`
29
+
- The state (memory) of the generator and its seed value (or source `rng`) are
30
+
not exposed
19
31
20
32
are expected to provide the following:
21
33
@@ -34,48 +46,44 @@ are expected to provide the following:
34
46
`OsRng` is a stateless "generator" implemented via [getrandom]. As such, it has
35
47
no possible state to leak and cannot be improperly seeded.
36
48
37
-
`ThreadRng` will periodically reseed itself, thus placing an upper bound on the
38
-
number of bits of output from an instance before any advantage an attacker may
39
-
have gained through state-compromising side-channel attacks is lost.
49
+
`StdRng` is a `CryptoRng` and `SeedableRng` using a pseudo-random algorithm
50
+
selected for good security and performance qualities. Since it does not offer
51
+
reproducibility of output, its algorithm may be changed in any release version.
52
+
53
+
`ChaCha12Rng` and `ChaCha20Rng` are selected pseudo-random generators
54
+
distributed by the `rand` project which meet the requirements of the `CryptoRng`
55
+
trait and implement `SeedableRng` with a commitment to reproducibility of
56
+
results.
57
+
58
+
`ThreadRng` is a conveniently-packaged generator over `StdRng` offering
59
+
automatic seeding from `OsRng`, periodic reseeding and thread locality.
60
+
This random source is intended to offer a good compromise between cryptographic
61
+
security, fast generation with reasonably low memory and initialization cost
62
+
overheads, and robustness against misuse.
40
63
41
64
[getrandom]: https://crates.io/crates/getrandom
42
65
43
66
### Distributions
44
67
45
-
Additionally, derivations from such an RNG (including the `Rng` trait,
46
-
implementations of the `Distribution` trait, and `seq` algorithms) should not
47
-
introduce significant bias other than that expected from the operation in
48
-
question (e.g. bias from a weighted distribution).
68
+
Methods of the `Rng` trait, functionality of the `rand::seq` module and
69
+
implementators of the `Distribution` trait are expected, while using a
70
+
cryptographically secure `CryptoRng` instance meeting the above constraints,
71
+
to not introduce significant bias to their operation beyond what would be
72
+
expected of the operation. Note that the usage of 'significant' here permits
73
+
some bias, as noted for example in the documentation of the `Uniform`
74
+
distribution.
49
75
50
76
## Supported Versions
51
77
52
-
We will attempt to uphold these premises in the following crate versions,
53
-
provided that only the latest patch version is used, and with potential
54
-
exceptions for theoretical issues without a known exploit:
55
-
56
-
| Crate | Versions | Exceptions |
57
-
| ----- | -------- | ---------- |
58
-
|`rand`| 0.8 ||
59
-
|`rand`| 0.7 ||
60
-
|`rand`| 0.5, 0.6 | Jitter |
61
-
|`rand`| 0.4 | Jitter, ISAAC |
62
-
|`rand_core`| 0.2 - 0.6 ||
63
-
|`rand_chacha`| 0.1 - 0.3 ||
78
+
We aim to provide security fixes in the form of a new patch version for the
79
+
latest release version of `rand` and its dependencies `rand_core` and
80
+
`rand_chacha`, as well as for prior major and minor releases which were, at some
81
+
time during the previous 12 months, the latest release version.
64
82
65
-
Explanation of exceptions:
66
-
67
-
- Jitter: `JitterRng` is used as an entropy source when the primary source
68
-
fails; this source may not be secure against side-channel attacks, see #699.
69
-
- ISAAC: the [ISAAC](https://burtleburtle.net/bob/rand/isaacafa.html) RNG used
70
-
to implement `ThreadRng` is difficult to analyse and thus cannot provide
71
-
strong assertions of security.
72
-
73
-
## Known issues
83
+
## Reporting a Vulnerability
74
84
75
-
In `rand` version 0.3 (0.3.18 and later), if `OsRng` fails, `ThreadRng` is
76
-
seeded from the system time in an insecure manner.
85
+
If you have discovered a security vulnerability in this project, please report it privately. **Do not disclose it as a public issue.** This gives us time to work with you to fix the issue before public exposure, reducing the chance that the exploit will be used before a patch is released.
77
86
78
-
## Reporting a Vulnerability
87
+
Please disclose it at [security advisory](https://github.com/rust-random/rand/security/advisories/new).
79
88
80
-
To report a vulnerability, [open a new issue](https://github.com/rust-random/rand/issues/new).
81
-
Once the issue is resolved, the vulnerability should be [reported to RustSec](https://github.com/RustSec/advisory-db/blob/master/CONTRIBUTING.md).
89
+
This project is maintained by a team of volunteers on a reasonable-effort basis. As such, please give us at least 90 days to work on a fix before public exposure.
0 commit comments