2017-02-09 12:30:06 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Gitlab::OtherMarkup, lib: true do
|
2017-04-24 07:57:11 -04:00
|
|
|
let(:context) { {} }
|
|
|
|
|
2017-02-09 12:30:06 -05:00
|
|
|
context "XSS Checks" do
|
|
|
|
links = {
|
|
|
|
'links' => {
|
|
|
|
file: 'file.rdoc',
|
|
|
|
input: 'XSS[JaVaScriPt:alert(1)]',
|
2017-04-24 07:57:11 -04:00
|
|
|
output: "\n" + '<p><a>XSS</a></p>' + "\n"
|
2017-02-09 12:30:06 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
links.each do |name, data|
|
|
|
|
it "does not convert dangerous #{name} into HTML" do
|
2017-04-24 06:20:46 -04:00
|
|
|
expect(render(data[:file], data[:input])).to eq(data[:output])
|
2017-02-09 12:30:06 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def render(*args)
|
|
|
|
described_class.render(*args)
|
|
|
|
end
|
|
|
|
end
|