Skip to content

Commit 9dcedaa

Browse files
committed
feat: use request session id to generate the nonce
1 parent 3290224 commit 9dcedaa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

variants/backend-base/config/initializers/content_security_policy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
# ###############
125125

126126
# If you are using UJS then enable automatic nonce generation
127-
config.content_security_policy_nonce_generator = ->(_request) { SecureRandom.base64(16) }
127+
config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
128128

129129
# Set the nonce only to specific directives
130130
# config.content_security_policy_nonce_directives = %w(script-src)

0 commit comments

Comments
 (0)