HERMES-GIELIE/api
Nathan Esquenazi 3c95502979 fix(auth): harden password_hash handling in settings API
Three security issues found during review:

1. password_hash exposed via GET /api/settings
   load_settings() returned all fields including the stored hash.
   Fix: strip password_hash from the response in routes.py.

2. password_hash directly settable via POST /api/settings
   'password_hash' was in _SETTINGS_ALLOWED_KEYS, so an attacker
   could POST {password_hash: 'X'} to hijack auth without knowing
   the current password.
   Fix: exclude password_hash from _SETTINGS_ALLOWED_KEYS.
   (Use _set_password for the legitimate hash-and-store path.)

3. Security headers missing from /api/auth/login and /api/auth/logout
   These endpoints built their responses manually (bypassing j()),
   so they omitted X-Content-Type-Options etc.
   Fix: call _security_headers() before end_headers() on both.

Tests updated: renamed test to assert key absent (not just None),
added new test verifying direct password_hash POST is blocked.
2026-04-03 06:21:04 -07:00
..
__init__.py Hermes Web UI — Sprints 11-14: multi-provider models, settings, session QoL, alerts, polish 2026-03-31 07:02:47 +00:00
auth.py feat: Sprint 19 — password auth, security headers, login page 2026-04-03 05:53:26 -07:00
config.py fix(auth): harden password_hash handling in settings API 2026-04-03 06:21:04 -07:00
helpers.py feat: Sprint 19 — password auth, security headers, login page 2026-04-03 05:53:26 -07:00
models.py feat: Sprint 15 — session projects, code copy button, tool card toggle 2026-04-02 00:11:49 -07:00
routes.py fix(auth): harden password_hash handling in settings API 2026-04-03 06:21:04 -07:00
streaming.py refactor: keep only model discovery, drop redundant routing changes 2026-04-02 09:15:41 -07:00
upload.py Hermes Web UI — Sprints 11-14: multi-provider models, settings, session QoL, alerts, polish 2026-03-31 07:02:47 +00:00
workspace.py Hermes Web UI — Sprints 11-14: multi-provider models, settings, session QoL, alerts, polish 2026-03-31 07:02:47 +00:00