Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Serializer does not properly escape/sanitize attribute values #114

Closed
distler opened this issue Dec 16, 2013 · 2 comments
Closed

New Serializer does not properly escape/sanitize attribute values #114

distler opened this issue Dec 16, 2013 · 2 comments
Milestone

Comments

@distler
Copy link
Collaborator

distler commented Dec 16, 2013

irb(main):001:0> require 'maruku'
=> true
irb(main):002:0> s = <<END
irb(main):003:0" *foo*{: style='ball & chain'}
irb(main):004:0"
irb(main):005:0" *foo*{: style='ball\008 chain'}
irb(main):006:0"
irb(main):007:0" *foo*{: style='ball\" badAttribute=\"chain'}
irb(main):008:0" END
=> "*foo*{: style='ball & chain'}\n\n*foo*{: style='ball\u00008 chain'}\n\n*foo*{: style='ball\" badAttribute=\"chain'}\n"
irb(main):009:0> Maruku.new(s).to_html
=> "<p><em style=\"ball & chain\">foo</em></p>\n\n<p><em style=\"ball\u00008 chain\">foo</em></p>\n\n<p><em style=\"ball\" badAttribute=\"chain\">foo</em></p>"

Nokogiri would ensure sane attribute values. So the output from the previous serializer would have been

<p><em style="ball &amp; chain">foo</em></p>

<p><em style="ball">foo</em></p>

<p><em style="ball&quot; badAttribute=&quot;chain">foo</em></p>

In addition to well-formedness issues, the third example has obvious security implications, depending on how the client program's sanitization works.

@bhollis
Copy link
Owner

bhollis commented Dec 16, 2013

Thanks, I'll get some tests in for that.

@bhollis
Copy link
Owner

bhollis commented Dec 16, 2013

Thanks. This is now fixed. Let me know if you find anything else that needs work, I'm building up a 0.7.1 release soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants