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:
kanywst
2026-07-19 13:40:39 +09:00
committed by nitnelave
parent 6d768a5e8c
commit ff81f08c18
+2 -2
View File
@@ -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)