diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..1d9b783 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +22.12.0 diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 0000000..6f7f377 --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +v16 diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..9e79f6c --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +ruby-3.2.2 diff --git a/app/views/heavy_markdown_editor/index.html.erb b/app/views/heavy_markdown_editor/index.html.erb index 5c1c444..426b712 100644 --- a/app/views/heavy_markdown_editor/index.html.erb +++ b/app/views/heavy_markdown_editor/index.html.erb @@ -1 +1 @@ -<%= react_component("HeavyMarkdownEditor", props: @heavy_markdown_editor_props, prerender: true) %> +<%= react_component("HeavyMarkdownEditor", props: @heavy_markdown_editor_props, prerender: false) %> diff --git a/app/views/hello_world/index.html.erb b/app/views/hello_world/index.html.erb index 2527b3e..818698e 100644 --- a/app/views/hello_world/index.html.erb +++ b/app/views/hello_world/index.html.erb @@ -1 +1 @@ -<%= react_component("HelloWorld", props: @hello_world_props, prerender: true) %> +<%= react_component("HelloWorld", props: @hello_world_props, prerender: false) %> diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index b3076b3..69958b3 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,25 +1,28 @@ # Be sure to restart your server when you modify this file. -# Define an application-wide content security policy. -# See the Securing Rails Applications Guide for more information: -# https://guides.rubyonrails.org/security.html#content-security-policy-header +# Define an application-wide content security policy +# For further information see the following documentation +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy -# Rails.application.configure do -# config.content_security_policy do |policy| -# policy.default_src :self, :https -# policy.font_src :self, :https, :data -# policy.img_src :self, :https, :data -# policy.object_src :none -# policy.script_src :self, :https -# policy.style_src :self, :https -# # Specify URI for violation reports -# # policy.report_uri "/csp-violation-report-endpoint" -# end -# -# # Generate session nonces for permitted importmap, inline scripts, and inline styles. -# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } -# config.content_security_policy_nonce_directives = %w(script-src style-src) -# -# # Report violations without enforcing the policy. -# # config.content_security_policy_report_only = true -# end +Rails.application.config.content_security_policy do |policy| + policy.default_src :self, :https + policy.font_src :self, :https, :data + policy.img_src :self, :https, :data + policy.object_src :none + policy.script_src :self, :https + policy.style_src :self, :https + + # Specify URI for violation reports + # policy.report_uri "/csp-violation-report-endpoint" +end + +# If you are using UJS then enable automatic nonce generation +Rails.application.config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } + +# Set the nonce only to specific directives +Rails.application.config.content_security_policy_nonce_directives = %w(script-src style-src) + +# Report CSP violations to a specified URI +# For further information see the following documentation: +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only +Rails.application.config.content_security_policy_report_only = true