aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2014-12-22 10:55:30 +0000
committerLouise Crow <louise.crow@gmail.com>2014-12-22 16:33:13 +0000
commit55f7ac2004f53ebc48efb90c45f64563a7cd660d (patch)
tree8a5e71cc0a4c03b4e9cf103a1fea688f07054860 /spec/controllers
parentb6cd9b05ae27370088c04973413730040f4ff08c (diff)
Sanitize the contents of HTML attachments before display
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/request_controller_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 9353efcb3..f5e876af1 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -596,6 +596,18 @@ describe RequestController, "when showing one request" do
response.status.should == 303
end
+ it "should sanitise HTML attachments" do
+ incoming_message = FactoryGirl.create(:incoming_message_with_html_attachment)
+ get :get_attachment, :incoming_message_id => incoming_message.id,
+ :id => incoming_message.info_request.id,
+ :part => 2,
+ :file_name => 'interesting.html',
+ :skip_cache => 1
+ response.body.should_not match("script")
+ response.body.should_not match("interesting")
+ response.body.should match('dull')
+ end
+
it "should censor attachments downloaded as binary" do
ir = info_requests(:fancy_dog_request)