mirror of
https://github.com/discourse/discourse.git
synced 2026-08-05 21:57:36 +08:00
When disabled, admins will be shown this warning in the dashboard: > The content-security-policy feature has been disabled. This is an important security feature, and should never be disabled in production environments. <a href=''>Re-enable it here</a>.
25 lines
688 B
Ruby
Vendored
25 lines
688 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
RSpec.describe ProblemCheck::ContentSecurityPolicyDisabled do
|
|
subject(:check) { described_class.new }
|
|
|
|
describe ".call" do
|
|
before { SiteSetting.stubs(content_security_policy: configured) }
|
|
|
|
context "when the content security policy is enabled" do
|
|
let(:configured) { true }
|
|
|
|
it { expect(check).to be_chill_about_it }
|
|
end
|
|
|
|
context "when the content security policy is disabled" do
|
|
let(:configured) { false }
|
|
|
|
it do
|
|
expect(check).to have_a_problem.with_priority("low").with_message(
|
|
I18n.t("dashboard.problem.content_security_policy_disabled", base_path: ""),
|
|
)
|
|
end
|
|
end
|
|
end
|
|
end
|