Skip to content

Security: -api-key CLI flag exposes the secret in the process list #68

Description

@LarsLaskowski

Source: Full code review 2026-07-17 (docs/reviews/2026-07-17-full-code-review.md), finding F11.
Category: security note · Severity: low · Effort: small

Problem

Any local user can read /proc/<pid>/cmdline, so passing the key via the -api-key flag (internal/config/config.go:318) leaks it to every process on the box — unlike the config file, which the installer correctly restricts to mode 640 root:pimonitor. README and docs/API.md mention the flag without a warning.

Suggested fix

Document that -api-key is for development only and the config file is the supported way to set the secret; optionally add a PIMONITOR_API_KEY environment variable as a middle ground (systemd Environment=/EnvironmentFile= friendly).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions