5fbbd3dd6e
A nonce-based Content-Security-Policy thwarts XSS attacks by allowing inline JavaScript to execute if the script nonce matches the header value. Rails 5.2 supports nonce-based Content-Security-Policy headers, so provide configuration to enable this and make it work. To support this, we need to change all `:javascript` HAML filters to the following form: ``` = javascript_tag nonce: true do :plain ... ``` We use `%script` throughout our HAML to store JSON and other text, but since this doesn't execute, browsers don't appear to block this content from being used and require the nonce value to be present.
14 lines
481 B
Text
14 lines
481 B
Text
- page_title @project.full_name
|
|
- page_description @project.description unless page_description
|
|
- header_title project_title(@project) unless header_title
|
|
- nav "project"
|
|
- @left_sidebar = true
|
|
|
|
- content_for :project_javascripts do
|
|
- project = @target_project || @project
|
|
- if current_user
|
|
= javascript_tag nonce: true do
|
|
:plain
|
|
window.uploads_path = "#{project_uploads_path(project)}";
|
|
|
|
= render template: "layouts/application"
|