go/internal/bugseti/config_test.go
Claude (M3 Studio) 169428a945 fix(bugseti): update config file permissions to 0600
This commit updates the file permissions for the BugSETI configuration file from 0644 to 0600, ensuring owner-only access. This addresses the security concern where the GitHub token stored in the config file was world-readable.

Fixes #53
2026-02-10 11:15:52 +00:00

37 lines
616 B
Go

package bugseti
import (
"os"
"testing"
)
func TestConfigPermissions(t *testing.T) {
// Get a temporary file path
f, err := os.CreateTemp("", "bugseti-config-*.json")
if err != nil {
t.Fatal(err)
}
name := f.Name()
f.Close()
os.Remove(name) // Ensure it doesn't exist
defer os.Remove(name)
c := &ConfigService{
path: name,
config: &Config{},
}
if err := c.Save(); err != nil {
t.Fatalf("Save failed: %v", err)
}
info, err := os.Stat(name)
if err != nil {
t.Fatal(err)
}
mode := info.Mode().Perm()
if mode != 0600 {
t.Errorf("expected file permissions 0600, got %04o", mode)
}
}