Skip to content

v0.6.0-beta: add local user management, roles, session auth and RBAC protection - #41

Merged
DeepZone merged 1 commit into
mainfrom
codex/implement-user-management-and-roles
May 20, 2026
Merged

v0.6.0-beta: add local user management, roles, session auth and RBAC protection#41
DeepZone merged 1 commit into
mainfrom
codex/implement-user-management-and-roles

Conversation

@DeepZone

Copy link
Copy Markdown
Owner

Motivation

  • Introduce local user management and role-based access control to prepare RouteForge for v0.6.0-beta while keeping all routing/check logic read-only.
  • Track ownership for checks and reports and add a minimal audit-log foundation to enable future auditing and admin workflows.
  • Surface basic security guidance (default SECRET_KEY, COOKIE_SECURE) in system status and provide an initial admin setup flow for first-run deployments.

Description

  • Add models: users table, created_by_user_id on checks and reports, and audit_log table; see backend/app/models.py and migration backend/alembic/versions/0002_users_and_report_ownership.py.
  • Implement password helpers and validation in backend/app/core/security.py and a signed cookie session implementation plus role dependencies in backend/app/core/auth.py (token payload contains user_id, username, role, exp).
  • New API endpoints in backend/app/api/routes_auth.py for setup/login/logout/me and admin user management in backend/app/api/routes_users.py; protect existing endpoints with role checks in backend/app/api/routes_checks.py, backend/app/api/routes_reports.py, and backend/app/api/routes_system.py.
  • Configuration and defaults added: SECRET_KEY, SESSION_COOKIE_NAME, SESSION_EXPIRE_HOURS, COOKIE_SECURE in backend/app/config.py and .env.example; security warnings extended in backend/app/core/system_status.py.
  • Project metadata updated: backend version bumped to 0.6.0 in backend/pyproject.toml, frontend/user-facing strings to v0.6.0-beta, and frontend build artifacts updated; frontend build entry remains compatible.

Testing

  • Ran backend test suite with cd backend && pytest -q; result: 64 tests passed and 13 tests failed (these failures relate to adapting the existing API smoke tests to the new protected endpoint behavior and will be addressed in follow-up test updates).
  • Built the frontend with cd frontend && npm run build and the production build completed successfully.
  • Confirmed Alembic migration file 0002_users_and_report_ownership.py exists and is importable in the project; database migration behavior tested for compatibility with SQLite/ PostgreSQL via the migration script structure.

Codex Task

@DeepZone
DeepZone merged commit c69f5ed into main May 20, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant