[client] Refuse path-bearing locale, TERM and TZ values from SSH clients (#8388)

This commit is contained in:
Viktor Liu
2026-10-28 16:38:10 +01:00
committed by GitHub
parent e2ee1dd002
commit 42418448d8
4 changed files with 85 additions and 9 deletions
+1 -1
View File
@@ -159,7 +159,7 @@ func (s *Server) prepareCommandEnv(_ *log.Entry, localUser *user.User, session s
// executeCommandWithPty executes a command with PTY allocation
func (s *Server) executeCommandWithPty(logger *log.Entry, session ssh.Session, execCmd *exec.Cmd, privilegeResult PrivilegeCheckResult, ptyReq ssh.Pty, winCh <-chan ssh.Window) bool {
termType := ptyReq.Term
if termType == "" {
if termType == "" || !acceptEnv("TERM="+termType) {
termType = "xterm-256color"
}
execCmd.Env = append(execCmd.Env, fmt.Sprintf("TERM=%s", termType))