Skip to content

Commit 38577d6

Browse files
committed
Fix the Sentry spam from CSP violations by disabling it.
1 parent f2cd21e commit 38577d6

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

config/initializers/secure_headers.rb

+2-12
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,7 @@
44
require 'gitlab/current_settings'
55
include Gitlab::CurrentSettings
66

7-
# If Sentry is enabled and the Rails app is running in production mode,
8-
# this will construct the Report URI for Sentry.
9-
if Rails.env.production? && current_application_settings.sentry_enabled
10-
uri = URI.parse(current_application_settings.sentry_dsn)
11-
CSP_REPORT_URI = "#{uri.scheme}://#{uri.host}/api#{uri.path}/csp-report/?sentry_key=#{uri.user}"
12-
else
13-
CSP_REPORT_URI = ''
14-
end
7+
CSP_REPORT_URI = ''
158

169
# Content Security Policy Headers
1710
# For more information on CSP see:
@@ -71,10 +64,7 @@
7164
upgrade_insecure_requests: true
7265
}
7366

74-
# Reports are sent to Sentry if it's enabled.
75-
if current_application_settings.sentry_enabled
76-
config.csp[:report_uri] = %W(#{CSP_REPORT_URI})
77-
end
67+
config.csp[:report_uri] = %W(#{CSP_REPORT_URI})
7868

7969
# Allow Bootstrap Linter in development mode.
8070
if Rails.env.development?

0 commit comments

Comments
 (0)