Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-23 03:09:14 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-23 03:09:14 +0300
commit9c71f76e2b49c070c35cb209fe3729e01a7ce92c (patch)
treef48aa6258fc5af462df9f20df28531fdfbfd20ae /app/controllers/concerns
parented45528885b7b44c61f18175fe7cdbda12360669 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/concerns')
-rw-r--r--app/controllers/concerns/static_object_external_storage_csp.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/controllers/concerns/static_object_external_storage_csp.rb b/app/controllers/concerns/static_object_external_storage_csp.rb
new file mode 100644
index 00000000000..0be83e31d8b
--- /dev/null
+++ b/app/controllers/concerns/static_object_external_storage_csp.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+module StaticObjectExternalStorageCSP
+ extend ActiveSupport::Concern
+
+ included do
+ content_security_policy do |p|
+ next if p.directives.blank?
+ next unless Gitlab::CurrentSettings.static_objects_external_storage_enabled?
+
+ default_connect_src = p.directives['connect-src'] || p.directives['default-src']
+ connect_src_values = Array.wrap(default_connect_src) | [Gitlab::CurrentSettings.static_objects_external_storage_url]
+ p.connect_src(*connect_src_values)
+ end
+ end
+end