Skip to content

Commit

Permalink
fix: disable nonce creation by default
Browse files Browse the repository at this point in the history
As the nonce should be unique per request, it doesn't make sense to
enable this by default, as that requires additional work on the serving
side.

On the other side, having a (static) random value isn't correct either.

So we keep the current logic, but disable nonce generation by default,
making it opt-in.

Closes trunk-rs#941
  • Loading branch information
ctron committed Jan 21, 2025
1 parent 16cf708 commit ca1b05a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/config/models/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pub struct Build {
pub allow_self_closing_script: bool,

/// Create 'nonce' attributes with a placeholder.
#[serde(default = "default::create_nonce")]
#[serde(default)]
pub create_nonce: bool,

/// The placeholder which is used in the 'nonce' attribute.
Expand Down Expand Up @@ -230,7 +230,7 @@ impl Default for Build {
minify: Default::default(),
no_sri: false,
allow_self_closing_script: false,
create_nonce: true,
create_nonce: false,
nonce_placeholder: default::nonce_placeholder(),
}
}
Expand Down

0 comments on commit ca1b05a

Please sign in to comment.