Skip to content

Commit 3e9babe

Browse files
koki-developclaude
andcommitted
fix: Prevent JavaScript injection in fontFamily configuration
Fixed a security vulnerability where unescaped fontFamily values could cause JavaScript syntax errors or arbitrary code execution. Now using strconv.Quote to properly escape special characters in font family names. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent db67b51 commit 3e9babe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

internal/ui/update.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package ui
33
import (
44
"fmt"
55
"path/filepath"
6+
"strconv"
67
"time"
78

89
"github.com/charmbracelet/bubbles/spinner"
@@ -145,8 +146,8 @@ func (m *Model) setupPage(page *rod.Page) error {
145146
}
146147

147148
// font family
148-
if m.config.Settings.FontFamily != nil {
149-
if _, err := page.Eval(fmt.Sprintf("() => term.options.fontFamily = '%s'", *m.config.Settings.FontFamily)); err != nil {
149+
if ff := m.config.Settings.FontFamily; ff != nil {
150+
if _, err := page.Eval(fmt.Sprintf("() => term.options.fontFamily = %s", strconv.Quote(*ff))); err != nil {
150151
return err
151152
}
152153
}

0 commit comments

Comments
 (0)