git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] shell: allow overriding built-in commands

From
Ayman Bagabas <ayman.bagabas@gmail.com>
Date
Mar 25, 2025, 22:44 UTC
Message-ID
<FA9BF11C-4237-4A0A-9C06-37F0C4E8B712@gmail.com>
In-Reply-To
<20250324202838.GB777700@coredump.intra.peff.net>
Show 28 quoted lines
> On Mar 24, 2025, at 11:28 PM, Jeff King <peff@peff.net> wrote:
> 
> On Sun, Mar 23, 2025 at 10:27:32PM -0700, Junio C Hamano wrote:
> 
>> Jeff King <peff@peff.net> writes:
>> 
>>> So it seems like a reasonable goal. A more restricted approach might be
>>> to provide a more formal hook/plugin interface. E.g., to run a hook
>>> script with the command name and arguments, and have it return
>>> success/failure to allow the to proceed.
>>> 
>>> That's not quite as flexible (in your approach I could replace what
>>> upload-pack is doing entirely, cache its output, and so on). But it
>>> might be harder for admins to screw up. I dunno.
>> 
>> Yeah, we usually try not to be overly flexible for that reason, but
>> given that "git shell" is so limited that rewriting its services
>> wholesale is not all that much of a deal, I think it is OK.
>> 
>> I however wonder if it is worth admins' time and effort to add
>> features to "git-shell" using this new facility, or if they are
>> better off using something more established like gitolite once they
>> want to go fancier beyond what the basic "git-shell" offers.
> 
> Yeah, I left my general opinions on git-shell unspoken. ;)
> 
> For features, I think you are probably better off with something like
> gitolite (which I think does have some access control).

Gitolite is a great software, but it also has its limitations. It couples authentication and authorization in the same system. However, I'm looking for something more flexible that I can plug whatever authentication or authorization system to the mix similar to git-http-backend paired with apache/nginx/h2o/etc.

Show 5 quoted lines
> 
> For security, I'd be a little scared of git-shell, just because it's not
> run all that frequently and we've had issues with it before (e.g.,
> integer overflows). If you're taking requests from untrusted clients,
> you're probably better off configuring http service.

That's a fair point. Perhaps writing my own restricted shell might be the best solution for what I'm looking for :/

Show 5 quoted lines
> 
> I also imagine there may be restricted shell implementations that are
> more general and more battle-hardened, that you could configure to only
> run a few commands. But I haven't looked at that space (because again,
> I'd suggest just git-over-http).

If you know any general restricted shell implementations please do tell. I'm looking for an SSH solution something pluggable like git-http-backend that I can build on top of.

Honestly, git-shell's simplicity is what got my interest at first. The fact that it's not secure and not run frequently can change and be improved.

- Ayman
Previous: Jeff King
Message 13 of 13 in “[RFC] shell: allow overriding built-in commands”
  1. [RFC] shell: allow overriding built-in commandsAyman Bagabas via GitGitGadget, Mar 22, 2025
  2. Elijah NewrenMar 22, 2025
  3. Ayman BagabasMar 22, 2025
  4. Elijah NewrenMar 22, 2025
  5. shell: allow overriding built-in commandsAyman Bagabas via GitGitGadget, Mar 23, 2025
  6. Chris TorekMar 23, 2025
  7. Ayman BagabasMar 23, 2025
  8. Chris TorekMar 23, 2025
  9. shell: allow overriding built-in commandsAyman Bagabas via GitGitGadget, Mar 23, 2025
  10. Jeff KingMar 24, 2025
  11. Junio C HamanoMar 24, 2025
  12. Jeff KingMar 24, 2025
  13. Ayman BagabasMar 25, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.