Login, first-user setup and sessions #10

Closed
opened 2026-11-07 18:57:50 +00:00 by vivy · 3 comments
Owner

What

First-user setup on an empty database, password login, session cookies.

Done when

A fresh database plus a browser gives an admin account and a session.

Depends on

#9

Plan

plan/server/users-and-permissions.md

Status

Planned for Nyssa.


Routing/Hold: no agent is routed to this issue automatically. To take it yourself, assign yourself. Vivy removes the hold when it is handed to an agent.
Created for GRI-1818 from plan/overview/roadmap.md and the MVP plan on GRI-1761.

## What First-user setup on an empty database, password login, session cookies. ## Done when A fresh database plus a browser gives an admin account and a session. ## Depends on #9 ## Plan plan/server/users-and-permissions.md ## Status Planned for Nyssa. --- `Routing/Hold`: no agent is routed to this issue automatically. To take it yourself, assign yourself. Vivy removes the hold when it is handed to an agent. Created for GRI-1818 from `plan/overview/roadmap.md` and the MVP plan on GRI-1761.
Member

Picking this up per GRI-1853 (board), as Unit 2 following #9b (database schema, merged into dev at 536d9e0). Note: this issue's body said "Planned for Nyssa" / Routing/Hold — no Nyssa branch exists and nobody else is active on it, so proceeding under the board assignment. Plan: Argon2id password hashing, first-user setup when no user exists, login/logout, HttpOnly+Secure+SameSite=Strict session cookie, auth extractor for panel routes. Branch: feature/GRI-1853-signage-auth-sessions off origin/dev.

Picking this up per GRI-1853 (board), as Unit 2 following #9b (database schema, merged into dev at 536d9e0). Note: this issue's body said "Planned for Nyssa" / Routing/Hold — no Nyssa branch exists and nobody else is active on it, so proceeding under the board assignment. Plan: Argon2id password hashing, first-user setup when no user exists, login/logout, HttpOnly+Secure+SameSite=Strict session cookie, auth extractor for panel routes. Branch: feature/GRI-1853-signage-auth-sessions off origin/dev.
Member

Implementation done, local gates running:

  • Argon2id password hashing (OWASP params, fixed non-secret dummy hash so unknown-email/wrong-password/unparsable-hash all pay one real verify, timing-equalised — same shape as the login use case in grimoire-of-helpdesk, GRI-129).
  • Random 32-byte session token, only its SHA-256 hash stored (same rule as a device token); cookie is HttpOnly, Secure, SameSite=Strict, 12h lifetime.
  • Routes per plan/server/rest-api.md: GET/POST /api/v1/setup(/status), POST/DELETE/GET /api/v1/session.
  • First-user creation is race-safe: the existence check and insert run in one transaction under a Postgres advisory lock, so two concurrent setup calls cannot both create an admin.
  • CurrentUser extractor for future panel routes; 401 is identical for a missing, malformed, or expired/deleted-session cookie.
  • 63 unit tests + 10 real-Postgres integration tests (crates/server/tests/auth_integration.rs), all green locally.

Running ./scripts/local-gates.sh --rust-only now; will push once it's clean.

Implementation done, local gates running: - Argon2id password hashing (OWASP params, fixed non-secret dummy hash so unknown-email/wrong-password/unparsable-hash all pay one real verify, timing-equalised — same shape as the login use case in grimoire-of-helpdesk, GRI-129). - Random 32-byte session token, only its SHA-256 hash stored (same rule as a device token); cookie is HttpOnly, Secure, SameSite=Strict, 12h lifetime. - Routes per plan/server/rest-api.md: GET/POST /api/v1/setup(/status), POST/DELETE/GET /api/v1/session. - First-user creation is race-safe: the existence check and insert run in one transaction under a Postgres advisory lock, so two concurrent setup calls cannot both create an admin. - CurrentUser extractor for future panel routes; 401 is identical for a missing, malformed, or expired/deleted-session cookie. - 63 unit tests + 10 real-Postgres integration tests (crates/server/tests/auth_integration.rs), all green locally. Running ./scripts/local-gates.sh --rust-only now; will push once it's clean.
vivy closed this issue 2026-11-10 04:35:14 +00:00
Author
Owner

Done: login, first-user setup and sessions in dev (PR #93, GRI-1853); empty-username fix followed.

Done: login, first-user setup and sessions in dev (PR #93, GRI-1853); empty-username fix followed.
Sign in to join this conversation.
No project
No assignees
2 participants
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
Grimoirix/grimoire-of-digital-signage#10
No description provided.