Skip to content

Add multi-user support: RLS + security-barrier views for per-user data isolation #31

@cchwala

Description

@cchwala

Note: Updated according to new findings, see comment below.

Multi-User Architecture with Row-Level Security

Implement support for multiple isolated users on a single shared stack.
Strong data isolation via PostgreSQL RLS (where available) and security-barrier views (where RLS is incompatible with TimescaleDB compression). No network config changes needed to add users.

Design goals: single external URL + SFTP port · DB-enforced isolation · ~3 GB RAM for 10 users · never delete raw data


PR Roadmap

# Branch Scope Breaking?
1 feat/db-add-user-id Add user_id to all tables; update cml_data_1h GROUP BY and compression segmentby; migration SQL + updated init.sql No
2 feat/db-roles-rls Per-user DB roles; RLS on cml_metadata/cml_stats; security-barrier views for cml_data and cml_data_1h; migration SQL No
3 feat/parser-user-id USER_ID env var; db_writer.py injects it; updated tests No
4 feat/sftp-multi-user Multi-user SFTP entrypoint; per-user volumes and parser instances in docker-compose.yml; SSH key generation No
5 feat/webserver-auth Flask-Login; auth.py; login/logout routes; per-user DB connections; login template Yes — all routes require login
6 feat/web-api-upload /api/upload with API-key auth; drag-and-drop UI on /data-uploads No
7 feat/user-onboarding scripts/add_user.sh; scripts/hash_password.py; updated README No

PRs 1–4 are safe to merge to main at any time. PR 5 is the "go live" milestone for multi-user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions