35959[TASK] Central function for escaping of shell-args
Commit message
Review
-
Code review CR +2
- Markus Klein +2
- Christian Kuhn +1
- Helmut Hummel +1
-
Verified V +2
- Markus Klein +2
- Christian Kuhn +1
Issues 1
Files 6
- typo3/sysext/backend/Classes/View/ThumbnailView.php+2 −19
- typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php+4 −21
- typo3/sysext/core/Classes/Resource/Processing/LocalImageProcessor.php3+6 −25
- typo3/sysext/core/Classes/Resource/Processing/LocalPreviewHelper.php5+12 −9
- typo3/sysext/core/Classes/Utility/CommandUtility.php21+37 −3
- typo3/sysext/scheduler/Classes/Scheduler.php4+5 −8
Review log 36
Show 11 earlier messages
-
Stefan Neufeind uploaded patch set 1 01/11/15, 22:44
-
Stefan Neufeind commented on patch set 1 01/11/15, 22:48
Is this a direction we might want to go? Utility-class chosen okay? Static call okay? (We can't really instantiate it everywhere imho.) There are some other places that currently use escapeshellarg() where we might want to look if those places also turn to the locale-aware escaping-variant to be clean.LocalImageProcessor.php:109since it is @internal and not used inside the core anymore, imho we might consider to even remove it without deprecation -
Markus Klein commented on patch set 1 CR -1 01/11/15, 23:23
BasicFileUtility is deprecated since ages. See note in header: Note: All methods in this class should not be used anymore since TYPO3 6.0. -
Stefan Neufeind commented on patch set 1 01/12/15, 01:01
Overlooked that. Which Utility-class and what method-name would you propose maybe? I've also thought about the CommandUtility for a moment, since that relates to executing commands (and so also possibly command-/argument-escaping imho). -
Markus Klein commented on patch set 1 01/12/15, 09:07
Yes I guess CommandUtil would be a better choice -
Stefan Neufeind uploaded patch set 2 01/17/15, 20:51
-
Stefan Neufeind commented on patch set 2 01/17/15, 20:53
now in CommandUtility and the BasicFileUtility is left untouched (since deprecated anyway)LocalImageProcessor.php:111since it is @internal and not used inside the core anymore, imho we might consider to even remove it without deprecation -
Mathias Schreiber commented on patch set 2 01/17/15, 21:30
LocalPreviewHelper.php:62is there a technical reason you didn't import this one on top? -
Mathias Schreiber commented on patch set 2 CR +1 V +1 01/17/15, 22:07
Scheduler.php:424Maybe shorten this (although not mandatory IMO) -
Stefan Neufeind commented on patch set 2 01/17/15, 22:08
LocalPreviewHelper.php:62ReplyNo, just because it was only used once. In the past we agreed to do it if something is used "a few times". But I don't mind. I just wanted to clear up the use-statements, since having Resource included and using Resource\File is afaik not what we usually do nowadays. -
Oliver Klee commented on patch set 2 01/18/15, 11:16
Isn't this more of a [FEATURE]?CommandUtility.php:426shell-argument -< shell argumentCommandUtility.php:430string|array -> string|string[]CommandUtility.php:431string|array -> string|string[]CommandUtility.php:445As we have this long check two time, maybe put it in a local variable $isUtf8FileSystem.Scheduler.php:424Reply+1 as this would probably allow us to write the whole construct in a single line.
-
Helmut Hummel commented on patch set 2 CR -1 01/18/15, 12:46
LocalImageProcessor.php:111Replyfine with me to directly remove itCommandUtility.php:114why is this changed to escapeshellcmd?CommandUtility.php:431ReplyI'd prefer not to have ambiguous return types, but only array() arguments and returns. A separate convenieve method could be added to handle the case for only one argument.CommandUtility.php:433"escapeShellArgumentLocal" does not make sense. It is "Locale" not "Local" but I would completely skip this suffix. And name it "escapeShellArguments" -
Oliver Klee commented on patch set 2 01/18/15, 12:51
CommandUtility.php:431Reply+1 -
Stefan Neufeind commented on patch set 2 01/18/15, 12:55
Reply
nothing "really changes" so far imho, just a cleanup / merging things in one central location. If we later use it to add escaping to other parts which maybe were "forgotton" so far that could imho then even become a bugfix (since it fixes potentially security-relevant parts).CommandUtility.php:114ReplyThere are separate functions for escaping a cmd and args. The correct one for calling gm is cmd here (though in real live I guess both will work).CommandUtility.php:433ReplyI originally stumbled across some parts where I thought me might need to escape there or not. But it was in FAL - and so I wanted to indicate we can only escape taking the "locale" into account for the *local* system. Fine with me to drop that suffix now.CommandUtility.php:445Replyfine with meScheduler.php:424ReplyBut not in the other case of this patchset? Or shorten it in both places (since the files are small and we don't have too much use-statements yet)? -
Oliver Klee commented on patch set 2 01/18/15, 12:58
Reply
Then I'm for either BUGFIX or CLEANUP.Scheduler.php:424Reply+1 for shortening both cases -
Oliver Klee commented on patch set 2 01/18/15, 12:59
"shell-args" -> "shell arguments" -
Helmut Hummel commented on patch set 2 01/18/15, 13:00
CommandUtility.php:114ReplyIf there is no particular reason (besides the existence of the other function), please keep it like it was. IMHO there were good reasons to use escapeshellarg here and there should be other good reasons to change it. -
Stefan Neufeind uploaded patch set 3 01/18/15, 13:06
-
Stefan Neufeind commented on patch set 3 01/18/15, 13:06
all feedback taken into account -
Mathias Schreiber commented on patch set 3 01/18/15, 13:08
LocalPreviewHelper.php:71missing s at a couple of places. -
Stefan Neufeind commented on patch set 3 01/18/15, 13:12
LocalPreviewHelper.php:71ReplyPlease see the function again! Helmut suggested to have one method which takes an array of strings and a separate "convenience method" for just one string. Since we escape just one string here, it doesn't have the plural. -
Helmut Hummel commented on patch set 3 CR -1 01/18/15, 13:19
CommandUtility.php:114I still don't want to see this changed (unless someone comes up with good reasons)CommandUtility.php:433typehint array pleaseCommandUtility.php:440this check will be obsolete thenCommandUtility.php:463I would go for return self::escapeShellArguments(array($input))[0]; but I'm also fine with the additional variable -
Helmut Hummel commented on patch set 3 01/18/15, 13:21
LocalPreviewHelper.php:71Replyyes, it is fine like that -
Stefan Neufeind commented on patch set 3 01/18/15, 13:23
CommandUtility.php:114ReplyWrong function used at the moment imho. There exist two separate functions for two separate usecases - and we should use the proper one. But maybe somebody else could comment as well. (No offense, Helmut. I really appreciate your input here.)CommandUtility.php:433ReplyackCommandUtility.php:440Replysure, sorryCommandUtility.php:463ReplyI wasn't exactly sure that works without an intermediate variable. If I remember right there was a problem in previous PHP-versions. But I tested it on a recent one and expect that 5.3+ should be fine with your suggested. Agreed, let's change that. -
Helmut Hummel commented on patch set 3 01/18/15, 13:36
CommandUtility.php:114ReplyThe name of the function is highly misleading and additionally escapeshellcmd() has a very limited use case. If we do not want to allow arbitrary arguments *and* want to be sure paths with spaces work properly, we *MUST* user escapeshellarg() here. Please do not change such crutial code if you do not know exactly why you're doing so. Thanks! -
Stefan Neufeind uploaded patch set 4 01/18/15, 13:42
-
Oliver Klee voted on patch set 4 CR +1 01/18/15, 13:51
-
Helmut Hummel voted on patch set 4 CR +2 01/18/15, 14:05
-
Markus Klein voted on patch set 4 CR +1 01/19/15, 00:28
-
Christian Kuhn commented on patch set 4 V -1 01/19/15, 22:21
PHP Parse error: syntax error, unexpected ';' in /var/www/t3master/cms/typo3/sysext/core/Classes/Utility/CommandUtility.php on line 434 -
Christian Kuhn uploaded patch set 5 01/19/15, 22:22
-
Christian Kuhn voted on patch set 5 CR +1 V +1 01/19/15, 22:23
-
Markus Klein voted on patch set 5 CR +1 01/19/15, 22:32
-
Helmut Hummel voted on patch set 5 CR +1 01/19/15, 22:34
-
Markus Klein voted on patch set 5 CR +2 V +2 01/19/15, 22:34
-
Markus Klein merged patch set 5 01/19/15, 22:34