video-accessibility/backend
Vadym Samoilenko 4949873440 feat(security): PR-1 multi-tenant isolation foundations
- Add `organization_id` field (denormalized from project.client_id) to Job,
  ReviewNote, VttVersion, and AuditLog models
- Introduce `get_user_org_ids()` and `assert_job_in_user_org()` helpers in
  `core/dependencies.py` — all staff roles now scope to their orgs; the
  dangerous `None` (unrestricted) fallback for LINGUIST/REVIEWER/PRODUCTION
  with no team assignment is eliminated (returns `[]` instead)
- Apply `assert_job_in_user_org` to `GET /jobs/{id}`, review-notes, and
  vtt-versions endpoints; bulk delete/approve/return-to-qc now skip jobs
  outside the requester's org instead of mutating cross-tenant data
- WebSocket `/ws/jobs/{job_id}` subscribe checks org membership before
  accepting the connection
- `POST /jobs` accepts `client_id` form field; derives `organization_id`
  from project lookup; removes blocking `time.sleep(1)` debug artifact
- `audit_logger.log_action` and `log_job_action` propagate `organization_id`
  so audit entries are org-scoped
- Add migration script `migrations/2026_05_add_organization_id.py` to
  backfill existing documents and create compound indexes
- Add `tests/unit/test_cross_tenant_isolation.py` with 10 unit tests
  covering ADMIN bypass, same-org pass, cross-org 404, project fallback,
  and legacy-job owner check

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-29 18:01:09 +01:00
..
app feat(security): PR-1 multi-tenant isolation foundations 2026-04-29 18:01:09 +01:00
migrations feat(security): PR-1 multi-tenant isolation foundations 2026-04-29 18:01:09 +01:00
tests feat(security): PR-1 multi-tenant isolation foundations 2026-04-29 18:01:09 +01:00
.dockerignore fixed dockerignore 2025-10-08 17:17:39 -05:00
.dockerignore.old wrote docker files and deployment instructions 2025-10-08 16:00:12 -05:00
.env.example feat: Client → Team → Project isolation system with Project Manager role 2026-04-27 15:11:13 +01:00
.gitignore feat: per-client glossary — hybrid exact/vector retrieval + AI injection 2026-04-29 13:03:38 +01:00
celery_worker.py fix: pause at start of gap + add explicit whisper_transcribe import 2025-12-27 09:11:29 -06:00
cors-config.json initial commit 2025-08-24 16:28:33 -05:00
create_test_users.py added production user role and made it default for new MSAL users - production can access everything EXCEPT user management - that's only for admin 2025-10-10 10:07:30 -05:00
debug_login.py initial commit 2025-08-24 16:28:33 -05:00
Dockerfile fix: add --no-root to poetry install in Dockerfiles (Poetry 2.x) 2026-04-29 14:35:28 +01:00
Dockerfile.ffmpeg-service feat: add Cloud Run HTTP services for Whisper and FFmpeg 2026-01-02 10:12:50 -06:00
Dockerfile.old wrote docker files and deployment instructions 2025-10-08 16:00:12 -05:00
Dockerfile.whisper-service fix: add --no-root to poetry install in Dockerfiles (Poetry 2.x) 2026-04-29 14:35:28 +01:00
gunicorn_conf.py initial commit 2025-08-24 16:28:33 -05:00
migrate.py initial commit 2025-08-24 16:28:33 -05:00
optical-414516-80e2475f6412.json initial commit 2025-08-24 16:28:33 -05:00
poetry.lock fix: regenerate poetry.lock + align whisper Dockerfile poetry version 2026-04-29 14:32:41 +01:00
pyproject.toml feat: per-client glossary — hybrid exact/vector retrieval + AI injection 2026-04-29 13:03:38 +01:00
setup_secrets.py initial commit 2025-08-24 16:28:33 -05:00
simple_login_test.py initial commit 2025-08-24 16:28:33 -05:00
test_auth.py initial commit 2025-08-24 16:28:33 -05:00
test_db.py initial commit 2025-08-24 16:28:33 -05:00
test_endpoint.py initial commit 2025-08-24 16:28:33 -05:00
test_mp3_serving.py initial commit 2025-08-24 16:28:33 -05:00
uv.lock docs: add canonical documentation + audit cleanup 2026-04-29 14:22:51 +01:00