require "test_helper" class StaticCspTest < ActionDispatch::IntegrationTest STATIC_POLICY = "default-src 'none'; img-src 'self'; style-src 'self'; " \ "base-uri 'none'; form-action 'none'; frame-ancestors 'none'" STATIC_PAGES = %w[ /400.html /404.html /406-unsupported-browser.html /422.html /500.html ] test "static pages are served with the locked-down static policy and no inline script" do STATIC_PAGES.each do |page| get page assert_response :ok assert_equal STATIC_POLICY, response.headers[ActionDispatch::Constants::CONTENT_SECURITY_POLICY], "#{page} must carry the static CSP" assert_no_match(/