Skip to content

Commit b5916dd

Browse files
committed
Add missing CSP directives that do not fall back to default-src
frame-ancestors, form-action, and base-uri do not inherit from default-src and must be explicitly defined. - frame_ancestors 'self': prevents clickjacking via iframe embedding - form_action 'self': restricts where forms can submit - base_uri 'self': prevents base tag injection attacks Note: report-to is not supported by secure_headers ~> 3.9; report-uri is already set and remains the reporting mechanism. CP4AIOPS-15067
1 parent be93876 commit b5916dd

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

config/initializers/secure_headers.rb

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,19 @@
2727
:report_only => false,
2828
:report_uri => ["/dashboard/csp_report"],
2929

30-
:default_src => ["'self'"],
31-
:child_src => ["'self'"],
32-
:connect_src => ["'self'"],
33-
:font_src => ["'self'", 'https://fonts.gstatic.com', "https://fonts.googleapis.com"],
34-
:frame_src => ["'self'"],
35-
:img_src => ["'self'", "data:"],
36-
:object_src => ["'self'"],
37-
:script_src => ["'unsafe-eval'", "'unsafe-inline'", "'self'"],
38-
:style_src => ["'unsafe-inline'", "'self'", "https://fonts.googleapis.com", "https://fonts.gstatic.com"],
39-
:worker_src => ["'self'"]
30+
:base_uri => ["'self'"],
31+
:default_src => ["'self'"],
32+
:child_src => ["'self'"],
33+
:connect_src => ["'self'"],
34+
:font_src => ["'self'", 'https://fonts.gstatic.com', "https://fonts.googleapis.com"],
35+
:form_action => ["'self'"],
36+
:frame_ancestors => ["'self'"],
37+
:frame_src => ["'self'"],
38+
:img_src => ["'self'", "data:"],
39+
:object_src => ["'self'"],
40+
:script_src => ["'unsafe-eval'", "'unsafe-inline'", "'self'"],
41+
:style_src => ["'unsafe-inline'", "'self'", "https://fonts.googleapis.com", "https://fonts.gstatic.com"],
42+
:worker_src => ["'self'"]
4043
}
4144
end
4245
end

0 commit comments

Comments
 (0)