Open westurner opened 10 years ago
[Also] a shortcut for rendering just the prettified HTML version (and/or a conditional contextual setting for defaulting to said behavior) would be outstanding. What an excellent teaching tool.
I'm not closing this one after the pull request since the problem is still here. Iframe looks like a good idea, maybe I'll explore it.
Good call. On further review, it looks like IFrames may introduce additional (those possibly lesser) concerns.
For reference, this is a Cross-Site Scripting (XSS) concern:
CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
As the warning in configure_ipython_beautifulsoup
explains, removing ('extracting') explicit <script>
and <style>
tags doesn't address:
<link rel="stylesheet" .../>
Approaches
Whitelisting
The HTML tags and attributes could be processed through a whitelis with something like https://pypi.python.org/pypi/bleach, but:
onclick
attributesIFrames
IFrames may be the 'safest' bet, though IFrames do introduce additional domain concerns.
.ipynb
CSS styles of displayed pages override the IPython notebook interface styles with URLs like e.g. http://downforeveryoneorjustme.com.
Without using IFrames, I'm not sure whether it's possible to avoid this without something like:
EDIT: Also JS.