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:
Diffstat (limited to 'app/controllers/concerns/vscode_cdn_csp.rb')
-rw-r--r--app/controllers/concerns/vscode_cdn_csp.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/concerns/vscode_cdn_csp.rb b/app/controllers/concerns/vscode_cdn_csp.rb
new file mode 100644
index 00000000000..dc8cea966e5
--- /dev/null
+++ b/app/controllers/concerns/vscode_cdn_csp.rb
@@ -0,0 +1,17 @@
+# rubocop:disable Naming/FileName
+# frozen_string_literal: true
+
+module VSCodeCDNCSP
+ extend ActiveSupport::Concern
+
+ included do
+ content_security_policy do |policy|
+ next if policy.directives.blank?
+
+ default_src = Array(policy.directives['default-src'] || [])
+ policy.directives['frame-src'] ||= default_src
+ policy.directives['frame-src'].concat(['https://*.vscode-cdn.net/'])
+ end
+ end
+end
+# rubocop:enable Naming/FileName