diff options
author | Robert Speicher <rspeicher@gmail.com> | 2016-02-22 01:33:35 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-02-22 01:33:35 +0300 |
commit | 4225fd229f8503c3007e07cbad2ccac319b2547b (patch) | |
tree | 0e0243eeb41a784551172ca020fe7702e9cf9dfb /spec/lib/banzai/filter/sanitization_filter_spec.rb | |
parent | 1367caa642e7ec9a46f202b6149a01e7093c573d (diff) |
Sanitize `data:` links
Closes #13625
Diffstat (limited to 'spec/lib/banzai/filter/sanitization_filter_spec.rb')
-rw-r--r-- | spec/lib/banzai/filter/sanitization_filter_spec.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/lib/banzai/filter/sanitization_filter_spec.rb b/spec/lib/banzai/filter/sanitization_filter_spec.rb index e14a6dbf922..247f492e6a9 100644 --- a/spec/lib/banzai/filter/sanitization_filter_spec.rb +++ b/spec/lib/banzai/filter/sanitization_filter_spec.rb @@ -156,13 +156,20 @@ describe Banzai::Filter::SanitizationFilter, lib: true do } protocols.each do |name, data| - it "handles #{name}" do + it "disallows #{name}" do doc = filter(data[:input]) expect(doc.to_html).to eq data[:output] end end + it 'disallows data links' do + input = '<a href="data:text/html;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4K">XSS</a>' + output = filter(input) + + expect(output.to_html).to eq '<a>XSS</a>' + end + it 'allows non-standard anchor schemes' do exp = %q{<a href="irc://irc.freenode.net/git">IRC</a>} act = filter(exp) |