File tree Expand file tree Collapse file tree 3 files changed +20
-6
lines changed
Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -220,6 +220,7 @@ http {
220220 add_header X-Content-Type-Options "nosniff";
221221 add_header Content-Security-Policy "$csp_policy";
222222 add_header Content-Security-Policy-Report-Only "$csp_policy_report";
223+
223224 location ~ ^/oedo02(.*) {
224225 return 301 https://magazine.rubyist.net/articles/0039/0039-MetPragdaveAtAsakusarb.html;
225226 }
@@ -506,6 +507,7 @@ http {
506507 set $csp_policy_report "default-src https:; report-uri https://<%= primary_host %> /_csp";
507508 }
508509 add_header X-Content-Type-Options "nosniff";
510+ add_header Strict-Transport-Security "max-age=31536000";
509511 add_header Content-Security-Policy "$csp_policy";
510512 add_header Content-Security-Policy-Report-Only "$csp_policy_report";
511513
@@ -515,7 +517,7 @@ http {
515517 proxy_hide_header Cache-Control;
516518 proxy_hide_header Expires;
517519 # 2015 sites and prior had mixed content issues
518- set $csp_policy "upgrade-insecure-requests; default-src https:";
520+ set $csp_policy "upgrade-insecure-requests; frame-ancestors 'none'; default-src https:";
519521 add_header Cache-Control "public, max-age=604800, s-maxage=31536000";
520522 proxy_pass https://2009-2011.rubykaigi.org;
521523 }
Original file line number Diff line number Diff line change 7272
7373 describe "/#{ subdir } /" do
7474 let ( :res ) { http_get ( "https://regional.rubykaigi.org/#{ subdir } /" ) }
75+
7576 it "returns ok" do
7677 #pending 'kanrk05.herokuapp.com is down' if path == '/kansai05/'
7778 #pending 'http://rubykaigi-hamamatsu.s3-website-ap-northeast-1.amazonaws.com/hamamatsu01/ returns C-T:application/javascript' if path == '/hamamatsu01/'
7879 #pending 'asakusa.github.io returns 301 (#110)' if path == '/oedo10/'
7980 expect ( res . code ) . to eq ( "200" )
8081 expect ( res [ "content-type" ] ) . to include ( "text/html" )
8182 end
83+
84+ it "has minimum security headers, but no hsts" do
85+ expect ( res [ "content-security-policy" ] ) . to include ( "default-src https:" )
86+ expect ( res [ "content-security-policy" ] ) . to include ( "upgrade-insecure-requests" )
87+ expect ( res [ "x-content-type-options" ] ) . to eq ( "nosniff" )
88+ expect ( res [ "strict-transport-security" ] ) . to be_nil
89+ end
8290 end
8391 end
8492 end
Original file line number Diff line number Diff line change 185185 end
186186 end
187187
188- describe "csp " do
188+ describe "security headers " do
189189 HOSTED_YEARS . each do |year |
190190 describe "/#{ year } /" do
191191 let ( :res ) { http_get ( "https://rubykaigi.org/#{ year } /" ) }
192- it "returns minimum csp header" do
193- expect ( res [ "content-security-policy-report-only" ] ) . to include ( "default-src https:;" )
192+ it "returns security header" do
193+ expect ( res [ "content-security-policy-report-only" ] ) . to include ( "default-src https:" )
194+ expect ( res [ "content-security-policy" ] ) . to include ( "frame-ancestors 'none'" )
195+ expect ( res [ "x-content-type-options" ] ) . to eq ( "nosniff" )
196+ expect ( res [ "strict-transport-security" ] ) . to include ( "max-age=" )
194197 end
195198 end
196199 end
197200
198201 ( 2006 ..2015 ) . each do |year |
199202 describe "/#{ year } /" do
200203 let ( :res ) { http_get ( "https://rubykaigi.org/#{ year } /" ) }
201- it "returns minimum csp header" do
202- expect ( res [ "content-security-policy" ] ) . to include ( "upgrade-insecure-requests;" )
204+ it "returns security header" do
205+ expect ( res [ "content-security-policy" ] ) . to include ( "default-src https:" )
206+ expect ( res [ "content-security-policy" ] ) . to include ( "upgrade-insecure-requests" )
203207 end
204208 end
205209 end
You can’t perform that action at this time.
0 commit comments