Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ENH,BUG,SEC: Jupyter support, HTML escaping #25

@westurner

Description

@westurner

I created a wrapper class to display HTML in JupyterLab; and then looked at the source and realized there's no cgi.escape / html.escape / bleach.clean / bleach.linkify; which (I assume) is an XSS vulnerability

class TabulateHTML:
    def __init__(self, *args, **kwargs):
        kwargs['tablefmt'] = 'html'
        self.html = tabulate(*args, **kwargs)
    def _repr_html_(self):
        return self.html
TabulateHTML(output)

There's likely a better way to wrap TableFormat to return either an object with a .repr_html() method or an IPython.display.HTML when tablefmt='jupyterhtml' | 'jupyter' | 'ipython'?

https://ipython.readthedocs.io/en/stable/config/integrating.html#rich-display

https://ipython.readthedocs.io/en/stable/api/generated/IPython.display.html#IPython.display.HTML

(edit)
Pull Requests:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions