Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
09595b4f
Kaydet (Commit)
09595b4f
authored
Mar 31, 2015
tarafından
Markus Holtermann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #24625 -- Prevented arbitrary file inclusion in admindocs
Thanks Tim Graham for the review.
üst
4e7ed8d0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
1 deletion
+18
-1
utils.py
django/contrib/admindocs/utils.py
+3
-1
1.8.1.txt
docs/releases/1.8.1.txt
+3
-0
evilfile.txt
tests/admin_docs/evilfile.txt
+0
-0
models.py
tests/admin_docs/models.py
+6
-0
tests.py
tests/admin_docs/tests.py
+6
-0
No files found.
django/contrib/admindocs/utils.py
Dosyayı görüntüle @
09595b4f
...
...
@@ -67,7 +67,9 @@ def parse_rst(text, default_reference_context, thing_being_parsed=None):
'doctitle_xform'
:
True
,
'inital_header_level'
:
3
,
"default_reference_context"
:
default_reference_context
,
"link_base"
:
reverse
(
'django-admindocs-docroot'
)
.
rstrip
(
'/'
)
"link_base"
:
reverse
(
'django-admindocs-docroot'
)
.
rstrip
(
'/'
),
'raw_enabled'
:
False
,
'file_insertion_enabled'
:
False
,
}
if
thing_being_parsed
:
thing_being_parsed
=
force_bytes
(
"<
%
s>"
%
thing_being_parsed
)
...
...
docs/releases/1.8.1.txt
Dosyayı görüntüle @
09595b4f
...
...
@@ -35,3 +35,6 @@ Bugfixes
* Fixed a regression in the model detail view of
:mod:`~django.contrib.admindocs` when a model has a reverse foreign key
relation (:ticket:`24624`).
* Prevented arbitrary file inclusions in :mod:`~django.contrib.admindocs`
(:ticket:`24625`).
tests/admin_docs/evilfile.txt
0 → 100644
Dosyayı görüntüle @
09595b4f
tests/admin_docs/models.py
Dosyayı görüntüle @
09595b4f
...
...
@@ -29,6 +29,12 @@ class Person(models.Model):
Field storing :model:`myapp.Company` where the person works.
(DESCRIPTION)
.. raw:: html
:file: admin_docs/evilfile.txt
.. include:: admin_docs/evilfile.txt
"""
first_name
=
models
.
CharField
(
max_length
=
200
,
help_text
=
"The person's first name"
)
last_name
=
models
.
CharField
(
max_length
=
200
,
help_text
=
"The person's last name"
)
...
...
tests/admin_docs/tests.py
Dosyayı görüntüle @
09595b4f
...
...
@@ -290,6 +290,12 @@ class TestModelDetailView(TestDataMixin, AdminDocsTestCase):
"all related
%
s objects"
%
(
link
%
(
"admin_docs.group"
,
"admin_docs.Group"
))
)
# "raw" and "include" directives are disabled
self
.
assertContains
(
self
.
response
,
'<p>"raw" directive disabled.</p>'
,)
self
.
assertContains
(
self
.
response
,
'.. raw:: html
\n
:file: admin_docs/evilfile.txt'
)
self
.
assertContains
(
self
.
response
,
'<p>"include" directive disabled.</p>'
,)
self
.
assertContains
(
self
.
response
,
'.. include:: admin_docs/evilfile.txt'
)
def
test_model_with_many_to_one
(
self
):
link
=
'<a class="reference external" href="/admindocs/models/
%
s/">
%
s</a>'
response
=
self
.
client
.
get
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment