Re: [dev][project] soap - a simple xdg-open replacement

From: Eon S. Jeon <esjeon_AT_hyunmu.am>
Date: Mon, 5 May 2014 01:23:03 -0400

Hello,

On Sun, May 04, 2014 at 06:52:25PM +0800, Chris Down wrote:
> FRIGN writes:
> > A configuration can look like this:
> >
> > { "\.mp3", "st -e mplayer %s" },
> > { "\.(jpg|png|tiff)$", "feh %s" },
> > { "\.gif", "wget -O /tmp/tmp.gif %s && gifview -a /tmp/tmp.gif" },
> > { "^(http://|https://)?(www\.)?(youtube.com/watch\?|youtu\.be/)", "youtube-viewer %s" }
>
> What happens if you unwittingly open "; rm -rf /; .jpg"? I'm not sure
> system() is really a good idea here.

Indeed, this is a huge concern, even though the argument gets escaped
befored being tossed into the shell. In-house string escape code is
always deemed insecure and incompetent, because of the dynamic nature of
shell script language. So, it's always the best if you can avoid
escaping once and for all.

Luckily, I came up with an alternative way of passing the argument. This
one uses an environment variable to store the argument, and lets the
shell expand the string for us. I've already implemented it, so you can
check it out.

https://github.com/esjeon/soap/commit/cec3f19ee151ab647dc8c5a544cb5e4277992531

Sincrely,
Eon
Received on Mon May 05 2014 - 07:23:03 CEST

This archive was generated by hypermail 2.3.0 : Mon May 05 2014 - 07:24:06 CEST