summaryrefslogtreecommitdiff
path: root/app/controllers/projects/tracings_controller.rb
blob: 2bc0c590e8d7d2be67c4c12799c85a511aaa9768 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

module Projects
  class TracingsController < Projects::ApplicationController
    content_security_policy do |p|
      next if p.directives.blank?

      global_frame_src = p.frame_src

      p.frame_src -> { frame_src_csp_policy(global_frame_src) }
    end

    before_action :authorize_update_environment!

    feature_category :tracing

    def show
    end

    private

    def frame_src_csp_policy(global_frame_src)
      external_url = @project&.tracing_setting&.external_url

      external_url.presence || global_frame_src
    end
  end
end