Tighten analytics usage log to 0600 for consistency with other on-disk writes #268

Closed
opened 2026-07-19 03:33:48 +00:00 by hexajon · 0 comments
hexajon commented 2026-07-19 03:33:48 +00:00 (Migrated from codeberg.org)

internal/analytics/analytics.go:145 opens usage.jsonl with mode 0644, while every other on-disk write in the project (serve.log, crashlog, gitconfig, staged binaries) uses 0600.

The contents are non-sensitive - the Event struct (lines 27-32) is only {ts, surface, command, outcome}, no arguments and no token - so this is not a credential leak. It's a minor local info-disclosure (which madtea commands ran, and when, readable by other local users on a shared host) plus an inconsistency with the file's own 0600 discipline.

Fix: open with 0600.

Acceptance: the analytics log is created 0600; a test or the existing perms coverage asserts it.

`internal/analytics/analytics.go:145` opens `usage.jsonl` with mode `0644`, while every other on-disk write in the project (serve.log, crashlog, gitconfig, staged binaries) uses `0600`. The contents are non-sensitive - the `Event` struct (lines 27-32) is only `{ts, surface, command, outcome}`, no arguments and no token - so this is not a credential leak. It's a minor local info-disclosure (which madtea commands ran, and when, readable by other local users on a shared host) plus an inconsistency with the file's own 0600 discipline. Fix: open with `0600`. Acceptance: the analytics log is created 0600; a test or the existing perms coverage asserts it.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sixfold-space/madtea#268
No description provided.