Adjust CSP reporting

pull/1398/head
Rick Carlino 2019-08-27 15:21:02 -05:00
parent 77bb85bb67
commit bb76d99ef5
2 changed files with 6 additions and 4 deletions

View File

@ -94,7 +94,8 @@ class DashboardController < ApplicationController
rescue
report = { problem: "Crashed while parsing report" }
end
Rollbar.info("CSP Violation", report)
# We get too many CSP reports.
# Rollbar.info("CSP Violation", report)
render json: report
end

View File

@ -20,14 +20,15 @@ describe DashboardController do
end
it "receives CSP violation reports (malformed JSON)" do
expect(Rollbar).to receive(:info)
.with("CSP Violation", { problem: "Crashed while parsing report" })
# expect(Rollbar).to receive(:info)
# .with("CSP Violation", { problem: "Crashed while parsing report" })
post :csp_reports, body: "NOT JSON ! ! !"
expect(json).to eq(problem: "Crashed while parsing report")
end
it "receives CSP violation reports (malformed JSON)" do
expect(Rollbar).to receive(:info).with("CSP Violation", {})
post :csp_reports, body: {}.to_json, params: { format: :json }
expect(json).to eq({})
end
it "creates a new user" do