Re: [PATCH] Allow aliases to expand to shell commands
- From
Theodore Tso <tytso@mit.edu>
- Date
- Feb 11, 2007, 00:13 UTC
- Message-ID
- <20070211001346.GA19656@thunk.org>
- In-Reply-To
- <Pine.LNX.4.63.0702102129110.22628@wbgn013.biozentrum.uni-wuerzburg.de>
On Sat, Feb 10, 2007 at 09:34:38PM +0100, Johannes Schindelin wrote:
Show 6 quoted lines
> > + if (alias_string[0] == '!') {
> > + trace_printf("trace: alias to shell cmd: %s => %s\n",
> > + alias_command, alias_string+1);
>
> Here, you add 1 to alias string (though I would put spaces around the
> plus, but that's really a nit).That's not how I code but it does seem to be the prevailing git coding style, so I'll change it.
> > + die("Failed to run '%s' when expanding alias '%s'\n",
> > + alias_string, alias_command);
>
> So, shouldn't you here, too?Yes, that makes the error message look a bit nicer. I'll respin the patch.
> It made me feel a little uneasy that we can execute _any_ command now, but > I can only find one way to exploit this, when an attacker does not have > shell access anyway: git-shell.
... and git-shell only allows git-receive-pack and git-upload-pack to be called, with a single argument, and aliases aren't allowed to override commands. So we're safe here, I think.
- Ted