mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 14:35:17 +08:00
DEV: Only include "report-sample" CSP directive when reporting is enabled (#9337)
This commit is contained in:
@ -29,7 +29,7 @@ describe CspReportsController do
|
||||
"line-number": 25,
|
||||
"source-file": "http://localhost:3000/",
|
||||
"status-code": 200,
|
||||
"script-sample": ""
|
||||
"script-sample": "console.log('unsafe')"
|
||||
}
|
||||
}.to_json, headers: { "Content-Type": "application/csp-report" }
|
||||
end
|
||||
@ -52,7 +52,7 @@ describe CspReportsController do
|
||||
|
||||
it 'logs the violation report' do
|
||||
send_report
|
||||
expect(Rails.logger.warnings).to include("CSP Violation: 'http://suspicio.us/assets.js'")
|
||||
expect(Rails.logger.warnings).to include("CSP Violation: 'http://suspicio.us/assets.js' \n\nconsole.log('unsafe')")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user