Skip to content

Commit 666cb2f

Browse files
committed
add another comment about random nonces
1 parent 7939aca commit 666cb2f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/web/csp.rs

+3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ pub(super) struct Csp {
88

99
impl Csp {
1010
fn new() -> Self {
11+
// Nonces need to be different for each single request in order to maintain security, so we
12+
// generate a new one with a cryptographically-secure generator for each request.
1113
let mut random = [0u8; 36];
1214
getrandom::getrandom(&mut random).expect("failed to generate a nonce");
15+
1316
Self {
1417
nonce: base64::encode(&random),
1518
suppress: false,

0 commit comments

Comments
 (0)