neuropoly / gitea

https://gitea.io fork with https://git-annex.branchable.com support
https://gitea.io
MIT License
3 stars 2 forks source link

Panic on `git-annex-shell` #12

Closed kousu closed 2 years ago

kousu commented 2 years ago

If I manually run git-annex-shell remotely through gitea, I get a panic:

$ ssh git@localhost git-annex-shell lol
Warning: Permanently added '[localhost]:2203' (RSA) to the list of known hosts.
panic: runtime error: index out of range [2] with length 2

goroutine 1 [running]:
code.gitea.io/gitea/cmd.runServ(0xc00024ab00)
    /home/GRAMES.POLYMTL.CA/p115628/src/gitea/cmd/serv.go:196 +0x302c
github.com/urfave/cli.HandleAction({0x25ceda0?, 0x37f6640?}, 0x4?)
    /home/GRAMES.POLYMTL.CA/p115628/go/pkg/mod/github.com/urfave/cli@v1.22.9/app.go:524 +0xa8
github.com/urfave/cli.Command.Run({{0x2a3aa7e, 0x4}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x2c76589, 0x2f}, {0x0, ...}, ...}, ...)
    /home/GRAMES.POLYMTL.CA/p115628/go/pkg/mod/github.com/urfave/cli@v1.22.9/command.go:173 +0x652
github.com/urfave/cli.(*App).Run(0xc000260000, {0xc00003c080, 0x4, 0x4})
    /home/GRAMES.POLYMTL.CA/p115628/go/pkg/mod/github.com/urfave/cli@v1.22.9/app.go:277 +0x8a7
main.main()
    /home/GRAMES.POLYMTL.CA/p115628/src/gitea/main.go:116 +0xcf9

this will never happen normally because git-annex handles feeding in arguments the right way, but this sort of thing means lurking bugs -- maybe security bugs.

kousu commented 2 years ago

Oh I found the bug. It was easy. This new line should fix it:

https://github.com/neuropoly/gitea/blob/fec07ed7c65bc20ea62f64e2e84dc9ece6f7ed38/cmd/serv.go#L191-L193