fix(terminal): ignore invalid shell config from race condition
Reject shell paths with length <= 1 to prevent errors when user input is accidentally sent as init message. Assisted-by: MiniMax-M2.7 via Crush <crush@charm.land>
This commit is contained in:
@@ -105,6 +105,12 @@ func (s *Server) handleTerminalWS(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// Ignore invalid shell paths (e.g., single characters from race condition)
|
||||
if len(shell) <= 1 {
|
||||
conn.WriteJSON(wsMessage{Type: "error", Data: "invalid shell config"})
|
||||
return
|
||||
}
|
||||
|
||||
if _, err := os.Stat(shell); err != nil {
|
||||
conn.WriteJSON(wsMessage{Type: "error", Data: fmt.Sprintf("shell not found: %s", shell)})
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user