Closed archerallstars closed 3 weeks ago
Can reproduce indeed with filenames with spaces. Will try to publish a fix asap Thanks!
Not only spaces. Filenames with special characters (?, ñ, ó...) don't work either.
Did some quick testing, and it looks like #249 (which I opened for another issue) also fixes this one.
Hmm that's strange that it fixes the issues... because the issues comes from this commit: https://github.com/Huluti/Curtail/commit/6f0774874bfd51ff445e2f9965e87e14c676d53b
I'm working on an other way to fix the vulnerability and fix this current issue.
Ah, it actually doesn't fix it. I didn't have that commit in my local repo. I'll look into some potential solutions too.
My thought is that we should remove the quote function, remove shell=True from the subprocess.run call and so pass command params as array and not a string. But it requires a bit of work...
Does Curtail already protect against shell injections since it puts double quotes around the filenames in the commands? I will admit I'm not very experienced in this area, so I'm not sure. Removing shell=True
seems like it would definitely protect against this though, so that's probably the better option.
There's one issue with removing shell=True
: you can't run multiple commands at once with this. That means that, afaik, there'll have to be another subprocess.run()
when compressing a JPEG in safe mode (because of the >
in the command), and when compressing a SVG in overwrite mode (because of the &&
in the command).
Edit: this would also affect lossy compression of PNGs.
Made a MR (#251) that'll hopefully solve both issues.
Tested it successfully. Release in progress: https://github.com/flathub/com.github.huluti.Curtail/pull/17 Many thanks again for your precious help.
I tried compressing PNG, JPEG, and WebP files without success. The app processes the files indefinitely.
The app worked well before version 1.11.0.
Debug info: