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

vscode_cdn_csp.rb « concerns « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: dc8cea966e5616b521d132f8d62615873588d176 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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