summaryrefslogtreecommitdiff
path: root/cmd/dashboard/main.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-01-26 07:03:53 -1000
committerPeter Stone <thepeterstone@gmail.com>2026-01-26 07:03:53 -1000
commit8c2b8c352f8c980c79bb4bb4772e8cbc02d14164 (patch)
tree6913a38cf462df397b24ba0c6c4c18f128562429 /cmd/dashboard/main.go
parentff7339acfdf533110f3ab1f902e153df739eed1b (diff)
Phase 3: Error handling and security hardening
- Handle JSON marshal errors in sqlite.go (log + fallback to empty array) - Add 30s timeout to Google Calendar client initialization - Fix CSRF timing attack by using subtle.ConstantTimeCompare Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'cmd/dashboard/main.go')
-rw-r--r--cmd/dashboard/main.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/cmd/dashboard/main.go b/cmd/dashboard/main.go
index d7da061..6b895d1 100644
--- a/cmd/dashboard/main.go
+++ b/cmd/dashboard/main.go
@@ -90,8 +90,11 @@ func main() {
var googleCalendarClient api.GoogleCalendarAPI
if cfg.HasGoogleCalendar() {
+ // Use timeout context to prevent startup hangs if credentials file is unreachable
+ initCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
var err error
- googleCalendarClient, err = api.NewGoogleCalendarClient(context.Background(), cfg.GoogleCredentialsFile, cfg.GoogleCalendarID)
+ googleCalendarClient, err = api.NewGoogleCalendarClient(initCtx, cfg.GoogleCredentialsFile, cfg.GoogleCalendarID)
+ cancel()
if err != nil {
log.Printf("Warning: failed to initialize Google Calendar client: %v", err)
} else {