fixed possible markdown xss
This commit is contained in:
parent
4da1293898
commit
07502fecc0
@ -1,5 +1,7 @@
|
|||||||
from django import template
|
from django import template
|
||||||
import markdown as md
|
import markdown as md
|
||||||
|
import bleach
|
||||||
|
from bleach_whitelist import markdown_tags, markdown_attrs
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
@ -11,4 +13,4 @@ def get_class(value):
|
|||||||
|
|
||||||
@register.filter()
|
@register.filter()
|
||||||
def markdown(value):
|
def markdown(value):
|
||||||
return md.markdown(value, extensions=['markdown.extensions.fenced_code'])
|
return bleach.clean(md.markdown(value, extensions=['markdown.extensions.fenced_code']), markdown_tags, markdown_attrs)
|
||||||
|
@ -7,6 +7,8 @@ djangorestframework
|
|||||||
django-autocomplete-light
|
django-autocomplete-light
|
||||||
django-emoji-picker
|
django-emoji-picker
|
||||||
django-cleanup
|
django-cleanup
|
||||||
|
bleach
|
||||||
|
bleach-whitelist
|
||||||
six
|
six
|
||||||
requests
|
requests
|
||||||
markdown
|
markdown
|
||||||
|
Loading…
Reference in New Issue
Block a user