5 ms·
Use imagemagick? What. the. fuck. This could be done in node, which almost everyone already has installed, and whose dependencies aren’t a pain in the ass to
by mcphage 9y ago
Use imagemagick? What. the. fuck.
This could be done in node, which almost everyone already has installed, and whose dependencies aren’t a pain in the ass to get installed and running.
- geofft 9y agoAlso node is memory-safe and Imagemagick isn't. Somewhat surprisingly to me, the two dependencies (get-pixels for reading and gif-encoder for writing) are both written in pure JS, meaning that using this solution is vastly more responsible than using Imagemagick, if you're handing it untrusted input images.
- franga2000 9y agoHow is ImageMagick not memory-safe? An attacker could only do damage if they discovered a very bad bug in ImageMagick, but such a bug could also be discovered in Node.
- fao_ 9y agoNot to mention the fact that npm is inherently insecure. https://ponyfoo.com/articles/npm-meltdown-security-concerns https://ponyfoo.com/articles/npm-meltdown-security-concerns https://www.bleepingcomputer.com/news/security/52-percent-of-all-javascript-npm-packages-could-have-been-hacked-via-weak-credentials/ https://www.bleepingcomputer.com/news/security/52-percent-of... https://github.com/joaojeronimo/rimrafall https://github.com/joaojeronimo/rimrafall https://github.com/npm/npm/issues/10999 https://github.com/npm/npm/issues/10999 https://twitter.com/o_cee/status/892306836199800836 https://twitter.com/o_cee/status/892306836199800836
- djsumdog 9y agoThere have been ImageMagick security bugs in the past, but it is an active project/community and they do get patched. I'd prefer using ImageMagick for something like this, but it's all about tradeoffs and what you're looking to do. There could be memory/security bugs in the future. There are also performance trade-offs if you created a microservice for this function in rmagic/ruby vs node (and you should do both and test them, because you might be surprised which one is actually faster). I agree it's best to use the right tool for the task, and there are valid reasons for using both in this case. I'd personally probably take the ruby/rmagick/ImageMagick approach myself in a container, but that's not to say that's the best approach.
- __s 9y agohttps://www.cvedetails.com/vulnerability-list/vendor_id-1749/Imagemagick.html https://www.cvedetails.com/vulnerability-list/vendor_id-1749...
- geofft 9y agoSuch very bad bugs get discovered regularly in Imagemagick. The most recent one is from earlier this month: https://github.com/ImageMagick/ImageMagick/issues/927 https://github.com/ImageMagick/ImageMagick/issues/927 and over 200 were found in 2017: http://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=imagemagick http://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=imagemagick (Of those, a bit under 100 were memory leaks, but the rest are things like buffer overflows.) Meanwhile, bugs that allow malformed input to trustworthy code in JavaScript to subvert or escape the JavaScript interpreter - or the equivalent bugs in Python, Ruby, Perl, etc. - are extremely rare. Of the bugs in 2017 in V8, Node's JavaScript interpreter, every single one of them requires specific malicious Javascript: http://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=v8 http://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=v8 It is very easy for a good programmer to accidentally write honest C code that has memory safety bugs that allow an attacker to take over your computer by sending it specially-crafted input. It is very hard for a good programmer to even intentionally write underhanded JS/Python/Ruby/Perl/etc. code that introduces one of these bugs without looking like it's trying to introduce one of them, let alone do so by accident. Of the security bugs in V8 from 2017 http://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=v8 http://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=v8, it looks like exactly one of them could be (and was) tripped by honest code, instead of code trying to subvert the interpreter: https://crbug.com/744584 https://crbug.com/744584 and if I'm reading it right, it's not even data-dependent. Either the code has the bug or it's not.
- fao_ 9y ago> which almost everyone already has installed, and Nope. Sorry to disappoint but I refuse to touch node with a barge-pole. Also 90% of the systems I deal with also don't have it installed. > whose dependencies aren’t a pain in the ass to get installed and running. pacman -S imagemagick sudo apt-get install imagemagick Wow, you're right that was an utter nightmare.
- deecewan 9y agopacman -S nodejs npm Why won't you touch node? It's a super handy scripting language.
- fao_ 9y agoI already have bash, mksh, awk, sed, vi's programming language, perl, python, C, Erlang, SBCL Lisp, and GUILE Scheme if I want a "super handy scripting language". Node is extremely bulky and things written in it tend not to be well-written. Not to mention that npm is inherently insecure: https://news.ycombinator.com/item?id=16195875 https://news.ycombinator.com/item?id=16195875
- runnr_az 9y agoThat's a problem, since you're gonna have to install this functionality on 100% of your systems!
- djsumdog 9y ago> whose dependencies aren’t a pain in the ass to get installed and running Well, now maybe. I have been able to reliably install stuff with yarn or even npm lately. A year ago though, whenever I saw a node project, I'd try to npm install it and it'd fail 60% of the time. When you do install something, dear god all the dependencies! So many dependencies! What do all of them do? I have no idea, but they're needed in this boilerplate to get this electron app running. I've found support in the node community to be pretty non-existent as well. It's easier to find elixir documentation than to get help with node apps. I've been stuck on this electron/vue.js issue forever and have gotten no help, and I've tried Gitter, Stackoverflow, Atom's issue tracker and IRC: https://github.com/electron/electron/issues/11388 https://github.com/electron/electron/issues/11388 https://stackoverflow.com/questions/48337401/unable-to-test-better-sqlite3-within-a-project-based-on-electron-vue-boilerplate https://stackoverflow.com/questions/48337401/unable-to-test-...