Skip to content

Commit f98f702

Browse files
Added paragraph to docs/model-api.txt explicitly pointing out file uploads should be validated, for security reasons
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3585 bcc190cf-cafb-0310-a4f2-bffc1f526a37
1 parent d07c2e9 commit f98f702

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

docs/model-api.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,14 @@ For example, say your ``MEDIA_ROOT`` is set to ``'/home/media'``, and
230230
upload a file on Jan. 15, 2007, it will be saved in the directory
231231
``/home/media/photos/2007/01/15``.
232232

233+
Note that whenever you deal with uploaded files, you should pay close attention
234+
to where you're uploading them and what type of files they are, to avoid
235+
security holes. *Validate all uploaded files* so that you're sure the files are
236+
what you think they are. For example, if you blindly let somebody upload files,
237+
without validation, to a directory that's within your Web server's document
238+
root, then somebody could upload a CGI or PHP script and execute that script by
239+
visiting its URL on your site. Don't allow that.
240+
233241
.. _`strftime formatting`: http://docs.python.org/lib/module-time.html#l2h-1941
234242

235243
``FilePathField``

0 commit comments

Comments
 (0)