mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
FIX: prevent self-xss in poll attributes
This commit is contained in:
@ -49,6 +49,14 @@ describe PostsController do
|
||||
expect(json["errors"][0]).to eq(I18n.t("poll.default_poll_must_have_less_options", max: SiteSetting.poll_maximum_options))
|
||||
end
|
||||
|
||||
it "prevents self-xss" do
|
||||
xhr :post, :create, { title: title, raw: "[poll name=<script>alert('xss')</script>]\n- A\n- B\n[/poll]" }
|
||||
expect(response).to be_success
|
||||
json = ::JSON.parse(response.body)
|
||||
expect(json["cooked"]).to match("data-poll-")
|
||||
expect(json["polls"]["<script>alert(xss)</script>"]).to be
|
||||
end
|
||||
|
||||
describe "edit window" do
|
||||
|
||||
describe "within the first 5 minutes" do
|
||||
|
Reference in New Issue
Block a user