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] << PIWIK["location"] if defined?(PIWIK)
22 csp_policy[:img_src] << PIWIK["location"] if defined?(PIWIK)
23 csp_policy[:script_src] << PIWIK["location"] if defined?(PIWIK)
25 csp_policy[:img_src] << Settings.storage_url if Settings.key?(:storage_url)
27 csp_policy[:report_uri] << Settings.csp_report_url if Settings.key?(:csp_report_url)
30 :httponly => { :only => ["_osm_session"] }
33 SecureHeaders::Configuration.default do |config|
34 config.hsts = SecureHeaders::OPT_OUT
35 config.referrer_policy = "strict-origin-when-cross-origin"
37 if Settings.csp_enforce
38 config.csp = csp_policy
39 config.csp_report_only = SecureHeaders::OPT_OUT
40 elsif Settings.key?(:csp_report_url)
41 config.csp = SecureHeaders::OPT_OUT
42 config.csp_report_only = csp_policy
44 config.csp = SecureHeaders::OPT_OUT
45 config.csp_report_only = SecureHeaders::OPT_OUT
48 config.cookies = cookie_policy