feat: improve chat ui messages (#132)

This commit is contained in:
Carlos Florêncio
2026-01-31 19:45:33 +00:00
committed by GitHub
parent ff4e0779d2
commit 6d23d68633
80 changed files with 4609 additions and 1470 deletions
@@ -1147,9 +1147,18 @@ func (wt *WorkspaceTracker) buildFileTreeNode(fullPath, relPath string, info os.
// GetFileContent returns the content of a file
func (wt *WorkspaceTracker) GetFileContent(reqPath string) (string, int64, error) {
// Resolve the full path with path traversal protection
fullPath := filepath.Join(wt.workDir, filepath.Clean(reqPath))
cleanWorkDir := filepath.Clean(wt.workDir)
cleanReqPath := filepath.Clean(reqPath)
// Resolve the full path - if already absolute and within workDir, use directly
var fullPath string
if filepath.IsAbs(cleanReqPath) && strings.HasPrefix(cleanReqPath, cleanWorkDir+string(os.PathSeparator)) {
fullPath = cleanReqPath
} else {
fullPath = filepath.Join(wt.workDir, cleanReqPath)
}
// Path traversal protection
if !strings.HasPrefix(fullPath, cleanWorkDir+string(os.PathSeparator)) && fullPath != cleanWorkDir {
return "", 0, fmt.Errorf("path traversal detected")
}