Language: Python
Label: safe
CWE: CWE-1336 \u2014 Improper Neutralization of Special Elements Used in a Template Engine
The product uses a template engine to insert or process externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements or syntax that can be interpreted as template expressions or other code directives when processed by the engine.

Code:
    def to_html(self) -> str:
        """
        Returns a rendered HTML representing the content of the tab.

        :return: a HTML string
        """
        from jinja2 import BaseLoader
        from jinja2.sandbox import SandboxedEnvironment

        j2_env = SandboxedEnvironment(loader=BaseLoader()).from_string(self.template)
        return j2_env.render({**self._context})