Skip to content
This repository was archived by the owner on Jan 5, 2019. It is now read-only.

Commit 9a70162

Browse files
committed
Merge pull request #1178 from ualbertalib/704_html_markup
closes #704 From a security perspective I tried some simple javascript injection into the description field and found it to be ineffective. ``` <script>alert('Injected!');</script> <BR SIZE="&{alert('Injected')}"> <DIV STYLE="background-image: url(javascript:alert('Injected'))"> ```
2 parents b594287 + f3fdc7a commit 9a70162

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<span itemprop="abstract">
2+
<%= iconify_auto_link(record.abstract) %>
3+
</span>
4+
<br />
5+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<span itemprop="is_version_of">
2+
<%= iconify_auto_link(record.is_version_of) %>
3+
</span>
4+
<br />
5+

spec/features/record_show_spec.rb

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
require 'spec_helper'
2+
3+
describe GenericFile do
4+
context 'record', :type => :feature do
5+
6+
let(:user) { FactoryGirl.find_or_create :user_with_fixtures }
7+
let!(:file) do
8+
GenericFile.new.tap do |f|
9+
f.resource_type = ["Thesis" ]
10+
f.read_groups = ['public']
11+
f.abstract = "This is a <a href=\"https://library.ualberta.ca\">test link</a>"
12+
f.is_version_of = "This is <b>bold</b> text."
13+
f.apply_depositor_metadata(user.user_key)
14+
f.save!
15+
end
16+
end
17+
18+
after :all do
19+
cleanup_jetty
20+
end
21+
22+
it "page should not have html tags" do
23+
visit "/files/#{file.id}"
24+
expect(page).to have_content('This is a test link')
25+
expect(page).to have_link('test link', href: 'https://library.ualberta.ca')
26+
parent = page.find("span[itemprop='is_version_of']")
27+
expect(parent).to have_css('b')
28+
expect(parent).to have_content('This is bold text.')
29+
end
30+
31+
end
32+
end

0 commit comments

Comments
 (0)