Skip to content

DevMode has no runtime safeguard beyond a config flag #26

Description

@goodtune

Severity: Medium
Location: internal/auth/auth.go:98-102, internal/config/config.go:32

When dev_mode: true is set, the /auth/test-login endpoint is enabled, which allows creating sessions for any username with any role (including admin) without any authentication. There is no safeguard to prevent this from being accidentally enabled in a deployment:

  • No warning is emitted at startup beyond a slog.Warn (which may be missed in production log noise).
  • The config can be set via the GHP_DEV_MODE environment variable.
  • There is no check that the server is listening only on localhost when dev mode is enabled.

Recommendation

  1. Refuse to start in dev mode if the listen address is not loopback (127.0.0.1, ::1, localhost). Add a --force-dev-mode flag to override this check explicitly.
  2. Reject /auth/test-login requests where r.RemoteAddr is not a loopback IP.
  3. Pass DevMode to the web UI template context and render a prominent red warning banner on all pages when active.

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions