mirror of
https://github.com/lldap/lldap.git
synced 2026-07-25 17:58:44 +00:00
server: use OsRng for refresh and password-reset tokens
gen_random_string generated the refresh and password-reset tokens with SmallRng, which is not a CSPRNG, while the rest of the codebase uses OsRng for secrets. Switch it to OsRng to match.
This commit is contained in:
@@ -15,8 +15,8 @@ use std::collections::HashSet;
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
fn gen_random_string(len: usize) -> String {
|
||||
use rand::{Rng, SeedableRng, distributions::Alphanumeric, rngs::SmallRng};
|
||||
let mut rng = SmallRng::from_entropy();
|
||||
use rand::{Rng, distributions::Alphanumeric, rngs::OsRng};
|
||||
let mut rng = OsRng;
|
||||
std::iter::repeat(())
|
||||
.map(|()| rng.sample(Alphanumeric))
|
||||
.map(char::from)
|
||||
|
||||
Reference in New Issue
Block a user