diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 09:45:46 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 09:45:46 +0000 |
commit | a7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch) | |
tree | 7452bd5c3545c2fa67a28aa013835fb4fa071baf /app/controllers/concerns/bizible_csp.rb | |
parent | ee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff) | |
download | gitlab-ce-a7b3560714b4d9cc4ab32dffcd1f74a284b93580.tar.gz |
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'app/controllers/concerns/bizible_csp.rb')
-rw-r--r-- | app/controllers/concerns/bizible_csp.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/controllers/concerns/bizible_csp.rb b/app/controllers/concerns/bizible_csp.rb new file mode 100644 index 00000000000..521f3127759 --- /dev/null +++ b/app/controllers/concerns/bizible_csp.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module BizibleCSP + extend ActiveSupport::Concern + + included do + content_security_policy do |policy| + next unless helpers.bizible_enabled? || policy.directives.present? + + default_script_src = policy.directives['script-src'] || policy.directives['default-src'] + script_src_values = Array.wrap(default_script_src) | ["'unsafe-eval'", 'https://cdn.bizible.com/scripts/bizible.js'] + policy.script_src(*script_src_values) + end + end +end |