Skip to content

Commit b8532f2

Browse files
edimarlnxclaude
andcommitted
gosec: 0600 test fixture, annotated preview read of the vetted save path
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MCypLQF5AD8JD831Ea9S9q
1 parent 0b02832 commit b8532f2

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎cmd/tui-firewall/manage_ui_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func TestSaveReportsAnUnchangedFile(t *testing.T) {
5656
t.Fatalf("SnapshotOwnTable: %v", err)
5757
}
5858
content := strings.TrimSpace(listing) + "\n"
59-
if err := os.WriteFile(path, []byte(content), 0o644); err != nil {
59+
if err := os.WriteFile(path, []byte(content), 0o600); err != nil {
6060
t.Fatalf("seeding the save file: %v", err)
6161
}
6262

‎cmd/tui-firewall/save.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (a *app) beginSave() tea.Cmd {
6969
// shows. A file that is missing or unreadable diffs as empty, which renders
7070
// every captured line as an addition — exactly what installing it would do.
7171
func currentSaveFile(path string) string {
72-
data, err := os.ReadFile(path)
72+
data, err := os.ReadFile(path) // #nosec G304 -- path is the vetted save location (constant or the TUI_FIREWALL_SAVE_PATH override), read only to render the preview diff
7373
if err != nil {
7474
return ""
7575
}

0 commit comments

Comments
 (0)