From ecb1b80e2471dda43838bbc43b62759bb4d5fe00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonne=20Ha=C3=9F?= Date: Sat, 24 May 2014 16:08:32 +0200 Subject: [PATCH] Render flash message content with .text .html does not escape any html input in these, leading to XSS attack vectors. Thanks to A Kai (@sixhundredns) for reporting the related issues. --- .../javascripts/widgets/flash-messages.js | 2 +- features/desktop/connects_users.feature | 19 ++++++++++++++++--- features/desktop/signs_up.feature | 7 +++++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/widgets/flash-messages.js b/app/assets/javascripts/widgets/flash-messages.js index 5c2dcf7e4..377120991 100644 --- a/app/assets/javascripts/widgets/flash-messages.js +++ b/app/assets/javascripts/widgets/flash-messages.js @@ -19,7 +19,7 @@ .html($("
", { 'class': "message" }) - .html(result.notice)) + .text(result.notice)) .prependTo(document.body); diff --git a/features/desktop/connects_users.feature b/features/desktop/connects_users.feature index 62c860e42..efa6f4a05 100644 --- a/features/desktop/connects_users.feature +++ b/features/desktop/connects_users.feature @@ -44,6 +44,19 @@ Feature: following and being followed When I am on the home page Then I should see "I am ALICE" + Scenario: I follow a malicious user + When I sign in as "bob@bob.bob" + And I go to the edit profile page + And I fill in the following: + | profile_first_name |