fix(convoy-tui): Address code review issues

- Add convoy ID validation to prevent SQL injection
- Add 5-second timeouts to all subprocess calls
- Batch issue lookups to eliminate N+1 query pattern
- Fix truncate() to handle multi-byte UTF-8 characters

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gastown/crew/jack
2025-12-31 13:22:02 -08:00
committed by Steve Yegge
parent 0428922697
commit 40f3a8dfd2
2 changed files with 70 additions and 25 deletions

View File

@@ -3,6 +3,7 @@ package convoy
import (
"fmt"
"strings"
"unicode/utf8"
"github.com/charmbracelet/lipgloss"
)
@@ -146,10 +147,14 @@ func statusToIcon(status string) string {
}
}
// truncate shortens a string to the given length.
// truncate shortens a string to the given rune length, preserving UTF-8.
func truncate(s string, maxLen int) string {
if len(s) <= maxLen {
if utf8.RuneCountInString(s) <= maxLen {
return s
}
return s[:maxLen-3] + "..."
runes := []rune(s)
if maxLen <= 3 {
return "..."
}
return string(runes[:maxLen-3]) + "..."
}