mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Enable strict-dynamic Content-Security-Policy by default (#26051)
Ref https://meta.discourse.org/t/298172 and https://meta.discourse.org/t/295603
This commit is contained in:
@@ -647,14 +647,14 @@ RSpec.describe ApplicationController do
|
||||
get "/"
|
||||
script_src = parse(response.headers["Content-Security-Policy"])["script-src"]
|
||||
|
||||
expect(script_src).to_not include("example.com")
|
||||
expect(script_src).to_not include("'unsafe-inline'")
|
||||
|
||||
SiteSetting.content_security_policy_script_src = "example.com"
|
||||
SiteSetting.content_security_policy_script_src = "'unsafe-inline'"
|
||||
|
||||
get "/"
|
||||
script_src = parse(response.headers["Content-Security-Policy"])["script-src"]
|
||||
|
||||
expect(script_src).to include("example.com")
|
||||
expect(script_src).to include("'unsafe-inline'")
|
||||
end
|
||||
|
||||
it "does not set CSP when responding to non-HTML" do
|
||||
|
||||
Reference in New Issue
Block a user