Skip to content

Commit 576124d

Browse files
author
Agus Makmun
committed
hotfix: XSS issues #173 #182
1 parent a7edc32 commit 576124d

13 files changed

+145
-21
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
* `Django>=3.2`
3535
* `Markdown>=3.0`
3636
* `requests>=2.12.4`
37+
* `bleach`
3738

3839

3940
### Installation
@@ -155,6 +156,21 @@ ALLOWED_URL_SCHEMES = [
155156
"file", "ftp", "ftps", "http", "https", "irc", "mailto",
156157
"sftp", "ssh", "tel", "telnet", "tftp", "vnc", "xmpp",
157158
]
159+
160+
# https://gist.github.com/mrmrs/7650266
161+
ALLOWED_HTML_TAGS = [
162+
"a", "abbr", "b", "blockquote", "br", "cite", "code", "command",
163+
"dd", "del", "dl", "dt", "em", "fieldset", "h1", "h2", "h3", "h4", "h5", "h6",
164+
"hr", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend",
165+
"li", "ol", "optgroup", "option", "p", "pre", "small", "span", "strong",
166+
"sub", "sup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "u", "ul"
167+
]
168+
169+
ALLOWED_HTML_ATTRIBUTES = [
170+
"alt", "class", "color", "colspan", "datetime", # "data",
171+
"height", "href", "id", "name", "reversed", "rowspan",
172+
"scope", "src", "style", "title", "type", "width"
173+
]
158174
```
159175

160176
Check this setting is not set else csrf will not be sent over ajax calls:

martor/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
__VERSION__ = "1.6.14"
4-
__RELEASE_DATE__ = "04-Sep-2022"
3+
__VERSION__ = "1.6.15"
4+
__RELEASE_DATE__ = "18-Nov-2022"
55
__AUTHOR__ = "Agus Makmun (Summon Agus)"
66
__AUTHOR_EMAIL__ = "summon.agus@gmail.com"

martor/settings.py

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,86 @@
138138
"xmpp",
139139
],
140140
)
141+
142+
# https://gist.github.com/mrmrs/7650266
143+
ALLOWED_HTML_TAGS = getattr(
144+
settings,
145+
"ALLOWED_HTML_TAGS",
146+
[
147+
"a",
148+
"abbr",
149+
"b",
150+
"blockquote",
151+
"br",
152+
"cite",
153+
"code",
154+
"command",
155+
"dd",
156+
"del",
157+
"dl",
158+
"dt",
159+
"em",
160+
"fieldset",
161+
"h1",
162+
"h2",
163+
"h3",
164+
"h4",
165+
"h5",
166+
"h6",
167+
"hr",
168+
"i",
169+
"iframe",
170+
"img",
171+
"input",
172+
"ins",
173+
"kbd",
174+
"label",
175+
"legend",
176+
"li",
177+
"ol",
178+
"optgroup",
179+
"option",
180+
"p",
181+
"pre",
182+
"small",
183+
"span",
184+
"strong",
185+
"sub",
186+
"sup",
187+
"table",
188+
"tbody",
189+
"td",
190+
"tfoot",
191+
"th",
192+
"thead",
193+
"tr",
194+
"u",
195+
"ul",
196+
],
197+
)
198+
199+
# https://github.com/decal/werdlists/blob/master/html-words/html-attributes-list.txt
200+
ALLOWED_HTML_ATTRIBUTES = getattr(
201+
settings,
202+
"ALLOWED_HTML_ATTRIBUTES",
203+
[
204+
"alt",
205+
"class",
206+
"color",
207+
"colspan",
208+
# "data",
209+
"datetime",
210+
"height",
211+
"href",
212+
"id",
213+
"name",
214+
"reversed",
215+
"rowspan",
216+
"scope",
217+
"src",
218+
"style",
219+
"title",
220+
"type",
221+
"width",
222+
],
223+
)

martor/static/martor/css/martor-admin.min.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

martor/static/martor/css/martor.bootstrap.min.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

martor/static/martor/css/martor.semantic.min.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

martor/static/martor/js/martor.bootstrap.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
2-
* Name : Martor v1.6.14
2+
* Name : Martor v1.6.15
33
* Created by : Agus Makmun (Summon Agus)
4-
* Release date : 04-Sep-2022
4+
* Release date : 18-Nov-2022
55
* License : GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
66
* Repository : https://github.com/agusmakmun/django-markdown-editor
77
**/

martor/static/martor/js/martor.bootstrap.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

martor/static/martor/js/martor.semantic.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
2-
* Name : Martor v1.6.14
2+
* Name : Martor v1.6.15
33
* Created by : Agus Makmun (Summon Agus)
4-
* Release date : 04-Sep-2022
4+
* Release date : 18-Nov-2022
55
* License : GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
66
* Repository : https://github.com/agusmakmun/django-markdown-editor
77
**/

martor/static/martor/js/martor.semantic.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)