Commit 2e9bf6a7 authored by Connor Shea's avatar Connor Shea

Add Sidekiq-specific headers.

parent e0ffbf0e
class Admin::BackgroundJobsController < Admin::ApplicationController
def show
use_secure_headers_override(:background_jobs)
ps_output, _ = Gitlab::Popen.popen(%W(ps -U #{Gitlab.config.gitlab.user} -o pid,pcpu,pmem,stat,start,command))
@sidekiq_processes = ps_output.split("\n").grep(/sidekiq/)
override_x_frame_options("SAMEORIGIN")
override_content_security_policy_directives(frame_ancestors: %w('self'))
end
end
......@@ -2,7 +2,6 @@ require 'gitlab/current_settings'
include Gitlab::CurrentSettings
uri = URI.parse(current_application_settings.sentry_dsn)
CSP_REPORT_URI = "#{uri.scheme}://#{uri.host}/api#{uri.path}/csp-report/?sentry_key=#{uri.user}"
SecureHeaders::Configuration.default do |config|
......@@ -32,7 +31,7 @@ SecureHeaders::Configuration.default do |config|
img_src: %w('self' www.gravatar.com secure.gravatar.com https:),
media_src: %w('none'),
object_src: %w('none'),
script_src: %w('unsafe-inline' 'self' maxcdn.bootstrapcdn.com),
script_src: %w('unsafe-inline' 'self'),
style_src: %w('unsafe-inline' 'self'),
base_uri: %w('self'),
child_src: %w('self'),
......@@ -42,4 +41,13 @@ SecureHeaders::Configuration.default do |config|
upgrade_insecure_requests: true, # see https://www.w3.org/TR/upgrade-insecure-requests/
report_uri: %W(#{CSP_REPORT_URI})
}
if Rails.env.development?
config.csp[:script_src] << "maxcdn.bootstrapcdn.com"
end
end
SecureHeaders::Configuration.override(:background_jobs) do |config|
config.csp[:frame_ancestors] = %w('self')
config.x_frame_options = 'SAMEORIGIN'
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment