Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jinja_filters.py: Add escaping for unsafe input. #229

Merged
merged 3 commits into from
May 1, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions json_schema_for_humans/jinja_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from jinja2 import pass_environment, Environment
from markdown2 import Markdown
from markupsafe import Markup
from markupsafe import Markup,escape as markupsafe_escape
from pygments import highlight
from pygments.formatters.html import HtmlFormatter
from pygments.lexers.javascript import JavascriptLexer
Expand Down Expand Up @@ -105,7 +105,7 @@ def get_description_literal(env: Environment, description: str) -> str:
if description and config.description_is_markdown and not config.result_extension == "md":
# Markdown templates are expected to already have Markdown descriptions
md: Markdown = env.globals["jsfh_md"]
description = Markup(md.convert(description))
description = Markup(md.convert(markupsafe_escape(description)))

return description

Expand Down
Loading