Skip to content

Commit 10ff527

Browse files
sapktechknowlogick
authored andcommitted
internal/ssh: ignore env command totally (go-gitea#6825)
* ssh: ignore env command totally * Remove commented code Needed fix described in issue go-gitea#6889
1 parent 2f21bc3 commit 10ff527

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

modules/ssh/ssh.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,6 @@ func handleServerConn(keyID string, chans <-chan ssh.NewChannel) {
5252
for req := range in {
5353
payload := cleanCommand(string(req.Payload))
5454
switch req.Type {
55-
case "env":
56-
args := strings.Split(strings.Replace(payload, "\x00", "", -1), "\v")
57-
if len(args) != 2 {
58-
log.Warn("SSH: Invalid env arguments: '%#v'", args)
59-
continue
60-
}
61-
args[0] = strings.TrimLeft(args[0], "\x04")
62-
_, _, err := com.ExecCmdBytes("env", args[0]+"="+args[1])
63-
if err != nil {
64-
log.Error("env: %v", err)
65-
return
66-
}
6755
case "exec":
6856
cmdName := strings.TrimLeft(payload, "'()")
6957
log.Trace("SSH: Payload: %v", cmdName)

0 commit comments

Comments
 (0)