feat(html_utils): introduce wildcard in sanitize_html

Introduces a wildcard i.e. Disallows all HTML tags when used.
This commit is contained in:
AarDG10 2026-04-13 17:28:57 +05:30
parent 2ac1998000
commit c3d8214124

View file

@ -170,7 +170,10 @@ def sanitize_html(html, linkify=False, always_sanitize=False, disallowed_tags=No
# Allow caller to explicitly disallow some tags
if disallowed_tags:
tags.difference_update(disallowed_tags)
if disallowed_tags == "*":
tags = set()
else:
tags.difference_update(disallowed_tags)
attributes = {"*": acceptable_attributes, "svg": svg_attributes}