Conversation
|
@IljaN |
|
@mmattel Good catch! It is not possible via webdav: mkcol .part Fails with 405 Method not allowed, not sure if it is the correct code tough. If you create the directory directly in your storage with mkdir .part it is ignored by owncloud |
|
@IljaN we should also block "$name.part" folders. Ignoring is not good. If you had the impression that OC ignores it, did you check the FS ? Maybe it created the folder still but it wasn't visible in the UI ? Better block those as well. |
|
@PVince81 .part directory creation is already prevented by this change: @mmattel I extended verfiyPath method with a extension check, this seems to catch all cases with the benefit that it is used in all codepaths (Single point of truth), what benefits does extending isForbiddenFileOr dir give us? |
|
@IljaN prove it with an integration test 😉 Is 400 bad request the correct code, same as for files ? Just asking, I thought we returned 403 for those but don't remember exactly. |
|
@IljaN nothing special, just remembered that we excluded stuff some time ago and thought it is maybe usable for your PR, never mind |
|
rebase conflicts |
|
@PVince81 let me fix them, I am also in the process adding a missing test |
f971a38 to
dc8004a
Compare
|
@PVince81 Ready |
lib/private/Files/View.php
Outdated
| } | ||
|
|
||
|
|
||
| if (pathinfo($fileName, PATHINFO_EXTENSION) == 'part') { |
There was a problem hiding this comment.
1d4f821 to
e97ac64
Compare
|
Ready for next review round |
lib/private/Files/View.php
Outdated
|
|
||
| if (preg_match('/' . FileInfo::BLACKLIST_FILES_REGEX . '/', $fileName) !== 0) { | ||
| throw new InvalidPathException( | ||
| 'Can`t upload files with extension .part because this extension is used internally by owncloud.' |
There was a problem hiding this comment.
wouldnt it be good to get the filename/component in question from the constant instead of hardcoding it?
There was a problem hiding this comment.
@IljaN see above comment
Also we cannot use the name "ownCloud" in error messages due to theming, please remove it
There was a problem hiding this comment.
Not sure if I understand I am getting it from FileInfo::BLACKLIST_FILES_REGEX
There was a problem hiding this comment.
To be precise, it is not the query but the text.
Here you state hardcoded .part
But the regex says const BLACKLIST_FILES_REGEX = '\.(part|filepart)$';
One name is missing.
What happens when the regex is extended with more names?
Extract the names and print them to be futureproof.
|
Ready for next round of review |
PVince81
left a comment
There was a problem hiding this comment.
👍 looks good to me, thanks a lot!
|
@IljaN please backport to stable10 |
…le_upload Prevent .part upload via dav
…d16643b1caf86bd16845 [stable10] Merge pull request #29011 from owncloud/prevent_dav_partfi…
|
stable10: #29432 |
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
Prevent creating, moving, copying to paths with extension .part
Related Issue
#7496
How Has This Been Tested?
Manually, Integration-Tests
Types of changes
Checklist: