question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

srcdoc in iframe not escaped correctly

See original GitHub issue

Describe the bug Content in srcdoc attribute of iframe needs additional escaping of & character. HTML spec. For example &lt; needs to be escaped to &amp;lt; 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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
pgasiorcommented, Nov 1, 2020

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;");

0reactions
bischoffdevcommented, Nov 30, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

srcdoc in iframe not escaped correctly · Issue #263 - GitHub
Report has iframe with content unescaped. When I open the attachment HTML file directly, it is escaped. To Reproduce Steps to reproduce the ......
Read more >
How to escape script tag within iframe src? - Stack Overflow
You should provide the path to your src attribute and the content should load within your iframe. Example: const a = document.
Read more >
Use <iframe> contents if srcdoc is present but empty - WICG
Namely, correctly munging raw hostile text so that it can't escape the sandbox is relatively difficult in a full HTML context, but is...
Read more >
The iframe srcdoc Attribute | #! code
This helps render the page correctly as all of the double quotes would otherwise need to be escaped. This works, but unfortunately the...
Read more >
New Relic Browser script breaks iframe srcdoc
New Relic browser monitor code is injected into the srcdoc attribute but because it is in an attribute the double quote (") from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found