Strip terminal controls from server text

This commit is contained in:
Brandon McGinty (chatgpt)
2026-08-09 14:30:07 -04:00
committed by Brandon McGinty
parent c3fe4f88f3
commit 6aeab4fd5c
3 changed files with 21 additions and 2 deletions
+9
View File
@@ -6,6 +6,15 @@ import (
"git.stormux.org/storm/barnard/gumble/gumble"
)
// Regression: HTML escaping left terminal control sequences in server text,
// allowing ANSI/OSC sequences to alter the terminal that rendered it.
func TestEscRemovesTerminalControlSequences(t *testing.T) {
got := esc("name\x1b]0;spoof\a\x7f\u202e")
if got != "name]0;spoof" {
t.Fatalf("unsafe terminal text %q", got)
}
}
func TestUserChangeNotification(t *testing.T) {
current := &gumble.Channel{ID: 1, Name: "Current"}
other := &gumble.Channel{ID: 2, Name: "Other"}