2 :preserve_schemes => true,
3 :default_src => %w['self'],
4 :child_src => %w['self'],
5 :connect_src => %w['self'],
6 :font_src => %w['none'],
7 :form_action => %w['self'],
8 :frame_ancestors => %w['self'],
9 :frame_src => %w['self'],
10 :img_src => %w['self' data: www.gravatar.com *.wp.com tile.openstreetmap.org *.tile.openstreetmap.org *.tile.thunderforest.com tileserver.memomaps.de *.openstreetmap.fr],
11 :manifest_src => %w['self'],
12 :media_src => %w['none'],
13 :object_src => %w['self'],
14 :plugin_types => %w[],
15 :script_src => %w['self'],
16 :style_src => %w['self'],
17 :worker_src => %w['none'],
21 csp_policy[:connect_src] << Settings.matomo["location"] if defined?(Settings.matomo)
22 csp_policy[:img_src] << Settings.matomo["location"] if defined?(Settings.matomo)
23 csp_policy[:script_src] << Settings.matomo["location"] if defined?(Settings.matomo)
25 csp_policy[:img_src] << Settings.avatar_storage_url if Settings.key?(:avatar_storage_url)
26 csp_policy[:img_src] << Settings.trace_image_storage_url if Settings.key?(:trace_image_storage_url)
28 csp_policy[:report_uri] << Settings.csp_report_url if Settings.key?(:csp_report_url)
31 :httponly => { :only => ["_osm_session"] }
34 SecureHeaders::Configuration.default do |config|
35 config.hsts = SecureHeaders::OPT_OUT
36 config.referrer_policy = "strict-origin-when-cross-origin"
38 if Settings.csp_enforce
39 config.csp = csp_policy
40 config.csp_report_only = SecureHeaders::OPT_OUT
41 elsif Settings.key?(:csp_report_url)
42 config.csp = SecureHeaders::OPT_OUT
43 config.csp_report_only = csp_policy
45 config.csp = SecureHeaders::OPT_OUT
46 config.csp_report_only = SecureHeaders::OPT_OUT
49 config.cookies = cookie_policy