8000 security #5287 Add a caution to the getUploadRootDir Doctrine (anacic… · symfony/symfony-docs@eb17948 · GitHub
[go: up one dir, main page]

Skip to content

Commit eb17948

Browse files
committed
security #5287 Add a caution to the getUploadRootDir Doctrine (anacicconi)
This PR was merged into the 2.3 branch. Discussion ---------- Add a caution to the getUploadRootDir Doctrine | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | all | Fixed tickets | #4177 Commits ------- a80d669 Add a caution to the getUploadRootDir - correction 69475d0 Adding a caution to the getUploadRootDir() method
2 parents 4566d33 + a80d669 commit eb17948

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cookbook/doctrine/file_uploads.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ file.
9999
If you're using annotations to specify your validation rules (as shown
100100
in this example), be sure that you've enabled validation by annotation
101101
(see :ref:`validation configuration <book-validation-configuration>`).
102+
103+
.. caution::
104+
105+
If you use the ``getUploadRootDir()`` method, be aware that this will save
106+
the file inside the document root, which can be accessed by everyone.
107+
Consider placing it out of the document root and adding custom viewing
108+
logic when you need to secure the files.
102109

103110
To handle the actual file upload in the form, use a "virtual" ``file`` field.
104111
For example, if you're building your form directly in a controller, it might

0 commit comments

Comments
 (0)
0