diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-23 00:09:14 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-23 00:09:14 +0000 |
commit | 9c71f76e2b49c070c35cb209fe3729e01a7ce92c (patch) | |
tree | f48aa6258fc5af462df9f20df28531fdfbfd20ae /app | |
parent | ed45528885b7b44c61f18175fe7cdbda12360669 (diff) | |
download | gitlab-ce-9c71f76e2b49c070c35cb209fe3729e01a7ce92c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/concerns/static_object_external_storage_csp.rb | 16 | ||||
-rw-r--r-- | app/controllers/ide_controller.rb | 2 |
2 files changed, 18 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 diff --git a/app/controllers/ide_controller.rb b/app/controllers/ide_controller.rb index 4c9aac9a327..d94f18beb5d 100644 --- a/app/controllers/ide_controller.rb +++ b/app/controllers/ide_controller.rb @@ -3,6 +3,8 @@ class IdeController < ApplicationController layout 'fullscreen' + include StaticObjectExternalStorageCSP + def index Gitlab::UsageDataCounters::WebIdeCounter.increment_views_count end |