File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
lib/qiita/markdown/transformers Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -42,10 +42,10 @@ def node
42
42
43
43
def host_of ( url )
44
44
if url
45
- port = URI . parse ( url ) . port
46
- Addressable ::URI . parse ( url ) . host if [ 443 , 80 ] . include? port
45
+ scheme = URI . parse ( url ) . scheme
46
+ Addressable ::URI . parse ( url ) . host if [ "http" , "https" ] . include? scheme
47
47
end
48
- rescue Addressable ::URI ::InvalidURIError
48
+ rescue Addressable ::URI ::InvalidURIError , URI :: InvalidURIError
49
49
nil
50
50
end
51
51
end
Original file line number Diff line number Diff line change @@ -44,10 +44,10 @@ def node
44
44
45
45
def host_of ( url )
46
46
if url
47
- port = URI . parse ( url ) . port
48
- Addressable ::URI . parse ( url ) . host if [ 443 , 80 ] . include? port
47
+ scheme = URI . parse ( url ) . scheme
48
+ Addressable ::URI . parse ( url ) . host if [ "http" , "https" ] . include? scheme
49
49
end
50
- rescue Addressable ::URI ::InvalidURIError
50
+ rescue Addressable ::URI ::InvalidURIError , URI :: InvalidURIError
51
51
nil
52
52
end
53
53
end
Original file line number Diff line number Diff line change 1616
1616
context "with embed iframe code with xss" do
1617
1617
let ( :markdown ) do
1618
1618
<<-MARKDOWN . strip_heredoc
1619
- <iframe src="javascript://docs.google.com/presentation/d/example/embed " frameborder="0" width="482" height="300" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>
1619
+ <iframe src="javascript://docs.google.com:80/%0d%0aalert(document.domain) " frameborder="0" width="482" height="300" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>
1620
1620
MARKDOWN
1621
1621
1622
1622
it "forces width attribute on iframe" do
You can’t perform that action at this time.
0 commit comments