trivago / cluecumber

Clear and concise reporting for the Cucumber BDD JSON format.

Home Page:https://www.softwaretester.blog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

srcdoc in iframe not escaped correctly

pgasior opened this issue · comments

Describe the bug
Content in srcdoc attribute of iframe needs additional escaping of & character. HTML spec.
For example < needs to be escaped to <
This shows when trying to display HTML escaped content inside <pre>
Report has iframe with content unescaped. When I open the attachment HTML file directly, it is escaped.

To Reproduce
Steps to reproduce the behavior:

  1. Add HTML attachment with <pre>&lt;h1&gt;should be escapedd&lt;/h1&gt;</pre>

Expected behavior
Escaped HTML tags remain escaped inside iframe in report

Attachments
JSFiddle with current behavior link
JSFiddle with expected behavior link

Thanks for reporting this!

I think that this also applies to escaping " in Embedding.decodeData(string). It shouldn't be converted to ' but to &quot;.
Citing the spec And remember to escape ampersands before quotation marks, to ensure quotation marks become &quot; and not &amp;quot;.

So if I understand this correctly fix would be in Embedding.java
decodedData.replaceAll("&", "&amp;").replaceAll("\"", "&quot;");

Will be fixed in 2.6.0 (release planned for today).

👋 @laxersaz do you see this as a potential security issue?
if it is, we (at Snyk would like to add it to our vulnerability database.

I don't quite follow your question. I am not an expert in software security.