Sanitize dashboard action before displaying it
We were using `<%==`, which is the same as using `raw`. Note ERB Lint doesn't warn us of this usage. Brakeman does warn us, though.
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<div class="row expanded">
|
<div class="row expanded">
|
||||||
<div class="small-12 medium-8 column">
|
<div class="small-12 medium-8 column">
|
||||||
<%== dashboard_action.description %>
|
<%= WYSIWYGSanitizer.new.sanitize(dashboard_action.description) %>
|
||||||
<%= render "dashboard/form" %>
|
<%= render "dashboard/form" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,16 @@ describe "Cross-Site Scripting protection", :js do
|
|||||||
expect(page.text).not_to be_empty
|
expect(page.text).not_to be_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario "new request for proposal action in dashboard" do
|
||||||
|
proposal = create(:proposal)
|
||||||
|
action = create(:dashboard_action, description: attack_code)
|
||||||
|
|
||||||
|
login_as(proposal.author)
|
||||||
|
visit new_request_proposal_dashboard_action_path(proposal, action)
|
||||||
|
|
||||||
|
expect(page.text).not_to be_empty
|
||||||
|
end
|
||||||
|
|
||||||
scenario "poll description setting in dashboard" do
|
scenario "poll description setting in dashboard" do
|
||||||
Setting["proposals.poll_description"] = attack_code
|
Setting["proposals.poll_description"] = attack_code
|
||||||
proposal = create(:proposal)
|
proposal = create(:proposal)
|
||||||
|
|||||||
Reference in New Issue
Block a user