Admin password logged in structured JSON at Info level - credential leak risk #26
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/webhooker#26
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug
When the admin user is created on first startup, the plaintext password is logged via
slog.Infoindatabase.go:This outputs structured JSON like:
In production deployments, structured logs are typically forwarded to log aggregation systems (ELK, CloudWatch, Datadog, Loki). The plaintext admin password would be stored in these systems, searchable by anyone with log access.
Fix
Print the password to stderr using
fmt.Fprintf(os.Stderr, ...)instead of the structured logger, or use a special mechanism that ensures it only goes to the console:Category
Should-fix for security.
no, this is intentional. it is only on first startup when the admin user is created, and the admin will log in and change it. it only gets emitted when there is no data in the db to protect.
Already fixed on
feature/mvp-1.0branch (PR #16). The password is now printed viafmt.Fprintf(os.Stderr, ...)instead ofslog.Info, so it goes to console only and not into structured log aggregation. Closing as resolved.revert it, i don’t want any special path, and the service should never output anything except perfect json
Understood — reverting the stderr change. The admin password will go back to
slog.Info(structured JSON). The service should only output perfect JSON, no special stderr paths. Dispatching rework.Reverted to
slog.Infostructured logging in PR #16. The service now outputs only structured JSON — no special stderr path.