Skip to content

RBAC v1 — Phase 1: local-only authentication & authorization #25

Open
0 of 4 issues completed
Open

Description

@SckyzO

RBAC v1 — Phase 1: local-only authentication & authorization

Goal

Replace Rackscope's current binary authorization model (anonymous | single-admin) with a proper role-based access control system: multi-user accounts stored in a local YAML file, role enum viewer | editor | admin, three role overrides for narrow read-access grants, plus file-based API tokens for external machine-to-machine integrations (NetBox, BlueBanquise, generic DCIM tools).

External identity providers (LDAP, OIDC, SAML, GitHub OAuth) are explicitly out of scope for this phase. They ship in Phase 2 under a separate RFC once Phase 1 is stable.

Design Reference

Full design rationale, decision tree, role model, storage format, forward-compatibility plan with Phase 2, and risk analysis are documented in the RFC: rackscope_documentation/docs/development/rfc-rbac.md.

Key decisions captured there:

  • Why a separate config/users.yaml file rather than embedding user state in app.yaml (GitOps cleanliness)
  • Why three roles and not a permission-builder UI (least-friction model for v1)
  • Why only three role overrides (viewer_can_read_inventory, viewer_can_read_metrics_config, editor_can_read_logs) and not arbitrary capability flags (YAGNI)
  • Why API tokens are not users (different identity class, different storage file, admin-only creation)
  • Why the local provider does not yet introduce the full AuthProvider abstraction (Phase 2 plugs in cleanly; over-abstracting now would be premature)

Sub-issues (implementation sequence)

The work is split into four PRs that ship in order. Each sub-issue is independently reviewable and mergeable.

  1. Issue A — fix(security): require_admin hardening on mutation endpoints (prerequisite)
  2. Issue C1 — feat(auth): local RBAC backend (users, role enum, require_role, CRUD)
  3. Issue B — feat(auth): file-based API tokens (NetBox / BlueBanquise integrations)
  4. Issue C2 — feat(frontend): role-based access control UI (page guards + Settings panels)

The native sub-issues panel on this issue will track progress.

Non-Regression Commitment

Every PR in this initiative MUST preserve the behaviour of existing deployments:

  • auth.enabled=false (default) → anonymous access behaviour unchanged
  • auth.enabled=true with single admin in app.yaml → boots, migrates automatically to users.yaml, login works with the same credentials, all endpoints respond identically
  • In-flight JWTs at the moment of the migration are still accepted (no forced re-login)

A dedicated tests/regression/ suite enforces this on every PR of the initiative.

Out of Scope

  • LDAP, OIDC, SAML, GitHub OAuth, generic OAuth — Phase 2 (future RFC)
  • Per-resource permissions (e.g., "user X can edit only site Y") — possibly a v2 concern
  • 2FA, TOTP, hardware keys — separate future issue
  • Audit log (logs/audit.jsonl) — recommended alongside Phase 1 but not blocking; tracked separately if pushed to a follow-up

Audit Reference

This initiative resolves limitations LIM-01 and LIM-02 from the architectural audit (AUDIT_ARCHITECTURAL.md). It does not address SEC-04 (config endpoint sanitization, tracked in Issue D, separate concern).

Sub-issues

Sub-issues

0 of 4 Issues completed
Loading 4 sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementsecurity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions