Commit Graph

789 Commits

Author SHA1 Message Date
Agent Zero 5ce85f4324 gate: fix worker on_startup to set tenant context per-tenant for plugin activation 2026-07-31 09:09:23 +02:00
Agent Zero 1a980ba9d8 gate: migration 0086, crm_migration BYPASSRLS, audit_log fix, CI test for app.tenant_id
- Migration 0086: Remove FORCE RLS from 5 global tables
- Migration 0085: crm_migration keeps BYPASSRLS for data migrations
- Migration 0085: Remove audit_log from crm_auth grants
- auth_service.py: Audit log via separate API session (crm_api with tenant context)
- tests/test_no_legacy_tenant_var.py: CI test for app.tenant_id in policies
2026-07-31 09:02:40 +02:00
Agent Zero 94318aaa4d phase1: acceptance report for Phase 0 + Phase 1 2026-07-31 02:29:32 +02:00
Agent Zero 15f0a07d4e phase1: fix auth_service tenant context for audit_log, add sessions+audit_log to crm_auth grants
- auth_service.py: set tenant context before audit log write in login
- migration 0085: add sessions and audit_log to AUTH_TABLES for crm_auth
- Login now works on production with RLS enabled
2026-07-31 02:28:29 +02:00
Agent Zero 100b9f705c phase1: separate DB roles, RLS restoration, login on crm_auth
Check Cross-Plugin Imports / check (push) Has been cancelled
- config.py: add auth_database_url, worker_database_url, migration_database_url
- db/__init__.py: separate engines for auth/worker/migration + get_auth_db/get_worker_db
- auth.py: all auth endpoints use get_auth_db (crm_auth role)
- auth_service.py: remove login fallback, require active membership, check status
- auth_service.py: switch_tenant checks active membership status
- alembic/env.py: use migration_database_url for Alembic
- docker-compose.yml: add AUTH_DATABASE_URL, WORKER_DATABASE_URL
- .env.example: add all 4 DB URLs with separate roles
- migration 0085: transfer ownership to crm_migration, fix BYPASSRLS,
  enable RLS+FORCE on all tenant tables, drop old policies, create new
  fail-closed policies scoped to crm_api+crm_worker, revoke excessive grants,
  grant minimal crm_auth access, drop crm_runtime, set default privileges
- tests/test_rls_coverage.py: automated RLS coverage check (13 tests)
- tests/test_cross_tenant_security_v2.py: RLS tests with unprivileged role
2026-07-31 02:05:16 +02:00
Agent Zero cdbbc1b6f0 phase0: frozen error list with 21 findings (10 P0, 7 P1 open, 4 P1 fixed) 2026-07-31 01:58:43 +02:00
Agent Zero 032a7e80a8 phase0: fix cross-plugin import, remove app.tenant_id, create cross-tenant v2 tests
- Fix report_generator/jobs.py: use DmsContract instead of direct DMS import
- Remove app.tenant_id from set_tenant_context (only app.current_tenant_id)
- Create tests/test_cross_tenant_security_v2.py with real RLS tests using
  unprivileged crm_api role (NOSUPERUSER, NOBYPASSRLS)
- Fix existing tests referencing app.tenant_id
- Git baseline tag v-phase0-baseline at 11d6faa
- Production DB backup at /tmp/crm_backup_20260731_015514.dump
2026-07-31 01:57:51 +02:00
Agent Zero 11d6faa34b fix: tsconfig exclude test files for frontend build
Check Cross-Plugin Imports / check (push) Has been cancelled
v-phase0-baseline
2026-07-31 01:33:52 +02:00
Agent Zero 0692fce2e4 fix: RLS fail-closed migration + per-tenant startup code 2026-07-31 01:31:41 +02:00
Agent Zero 7fbbe420bd fix: comprehensive system audit fixes (55+ issues)
Check Cross-Plugin Imports / check (push) Has been cancelled
CRITICAL:
- Fix SQL injection in prestart.sh (parameterized query)
- Fix secret key validation (always validate, not just production)
- Fix workspace model partial index bug (func.text -> text)
- Fix HealthResponse schema (add checks field)
- Fix Tenant import in permissions.py (NameError on every auth request)
- Fix README tech stack (React instead of Alpine.js)
- Delete broken test_cross_tenant_security_v2.py
- Add fail-closed RLS migration 0084 (48 tenant tables)

HIGH:
- Add GeneralRateLimitMiddleware for all API routes
- Add file type blocklist for DMS and attachment uploads
- Fix guest auth: Pydantic schema, tenant_slug required, CSRF bypass
- Fix CSRF bypass path matching (in -> endswith)
- Add worker healthcheck in docker-compose.yml
- Add ARQ max_tries=3 for job retries
- Fix 28 bare pass in mail services (-> logger.debug)
- Fix print() -> logger in main.py and ai_assistant
- Fix duplicate email handling (catch IntegrityError -> 409)
- Add session revocation (invalidate_all_user_sessions)
- Add resource limits to all containers
- Fix CORS default (localhost -> production domain)
- Fix SameSite=Lax -> Strict
- Fix Redis password visibility in healthcheck
- Fix npm vulnerabilities (19 -> 9)
- Fix Sidebar OOM (wildcard lucide import -> curated ICON_MAP)

MEDIUM:
- Localize ErrorBoundary to German
- Wire Mail.tsx save/delete filter to API
- Document system_notif plugin (no routes needed)
- Fix datetime.utcnow() -> datetime.now(UTC)
- Pin litellm version (>=1.0,<2.0)
- Move CSRF token from sessionStorage to in-memory
- Fix restore_backup error handling and transaction
- Fix Dms.tsx useEffect cleanup
- Add skip-to-content link for accessibility
- Add selectinload imports to 3 services
- Add .env.example missing variables
- Fix AppShell/TopBar/Sidebar test mocks

NEW TESTS:
- test_guest_auth.py (6 tests)
- test_user_service.py (8 tests)
- test_backup_service.py (5 tests)

NEW SCHEMAS:
- saved_filter, saved_view, user_preference, workspace, entity_policy

Tests: 22/22 PASSED
2026-07-31 00:58:05 +02:00
Agent Zero 44696b9c04 fix: import Navigate from react-router-dom 2026-07-30 20:03:10 +02:00
Agent Zero beb4169b03 feat: start page after login with workspace grid, login redirect to /start 2026-07-30 20:02:28 +02:00
Agent Zero f7c60069d5 fix: increase mail page_size limit to 10000 for grouping all mails
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-07-30 18:45:31 +02:00
Agent Zero 3d9c8e03eb fix: mail grouping loads all mails at once with large page_size, no infinite scroll during grouping 2026-07-30 18:44:43 +02:00
Agent Zero 7cc07c6e55 fix: MailList imports - useState + remove duplicate Mail type 2026-07-30 18:04:37 +02:00
Agent Zero 2f4f9803b9 fix: mail grouping collapsible groups, no sticky header, recursive subgroups with all mails 2026-07-30 18:03:48 +02:00
Agent Zero 61b9d2958e feat: mail group panel with date day/week/month/year grouping options 2026-07-30 16:03:11 +02:00
Agent Zero 679c6abc6d feat: mail grouping with group headers in MailList, connected to GroupPanel 2026-07-30 15:05:37 +02:00
Agent Zero 78724ce8f1 fix: mobile MailList props for infinite scroll 2026-07-30 13:39:36 +02:00
Agent Zero cfeac52058 feat: Mail infinite scroll, remove sort header + pagination, connect filter/sort to MailList 2026-07-30 13:38:43 +02:00
Agent Zero 75432cbcfd fix: connect MailFilterPanel and MailSortPanel to MailList with useMemo 2026-07-30 13:29:08 +02:00
Agent Zero 952890d95c fix: MailGroupPanel subGroups variable name conflict 2026-07-30 13:22:59 +02:00
Agent Zero d6c4827915 fix: MailFilterPanel missing closing brace in ternary 2026-07-30 13:22:19 +02:00
Agent Zero 7903d719b7 feat: Mail FilterPanel, SortPanel, GroupPanel like Contacts + remove saved-filters button from Contacts and Mail 2026-07-30 13:20:45 +02:00
Agent Zero b1cb20c12f fix: savedFilters possibly undefined TypeScript fix 2026-07-30 13:03:54 +02:00
Agent Zero c30a48cf63 fix: mail filter as dropdown like contacts (sort + saved filters), remove inline custom components 2026-07-30 13:03:11 +02:00
Agent Zero a9a9476e9f fix: contact_folder_service db.refresh after commit + AI stream own DB session in generator
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-07-30 12:49:53 +02:00
Agent Zero acea622a0f fix: AI loop prevention (no tools on last iteration), calendar button first, mail filter in toolbar, AI folder rename query invalidation
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-07-30 11:33:45 +02:00
Agent Zero 124846ae3b fix: workflow route remove is_system_admin param not accepted by service 2026-07-30 11:16:56 +02:00
Agent Zero c79fbe7fbb fix: WorkflowEditor TypeScript unknown type cast 2026-07-30 10:56:57 +02:00
Agent Zero 2cd3f30f82 fix: workflow 422 validation + report 500 DB data fetching + AI stream tenant context
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-07-30 10:54:28 +02:00
Agent Zero 3f2f594847 fix: AI stream route missing set_tenant_context causing RLS INSERT failure
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-07-30 10:45:34 +02:00
Agent Zero 076134b445 migration: add missing deleted_at columns to 9 TenantMixin tables (0083) 2026-07-30 10:16:26 +02:00
Agent Zero 5efc0e6c9d fix: customFieldDefs.items optional chaining in SortPanel, GroupPanel, FilterPanel 2026-07-30 10:12:19 +02:00
Agent Zero b3cf4474be fix: fast-deploy.sh also cleans sw.js, registerSW.js, workbox-*.js 2026-07-30 09:43:29 +02:00
Agent Zero 80952bd047 fix: remove PWA service worker (was caching stale assets), add SW unregister 2026-07-30 09:41:37 +02:00
Agent Zero 84aab20256 fix: fast-deploy.sh clears old assets before copying to prevent stale JS files 2026-07-30 09:38:31 +02:00
Agent Zero 02e188dfa2 fix: customFieldDefs.items optional chaining to prevent crash on empty response 2026-07-30 09:35:32 +02:00
Agent Zero 8acc00c559 migration: add sensitivity column to custom_field_definitions (0082) 2026-07-30 09:27:04 +02:00
Agent Zero ba0c4af42f fix: ContactsList canAccess fallback + ContactFolderTree error handling with toast 2026-07-30 02:56:40 +02:00
Agent Zero 2836d6083e fix: add async_session_maker alias in db/__init__.py for plugin imports 2026-07-30 02:48:21 +02:00
Agent Zero 88bcbfa9a8 fix: add app/core/redis.py shim re-exporting get_redis from auth 2026-07-30 02:01:28 +02:00
Agent Zero 25e70cf749 fix: canAccess + isModuleVisible fallback while permissions loading (contacts + settings link) 2026-07-30 01:53:30 +02:00
Agent Zero c5f0ef9d4d fix: canAccess returns true while permissions are loading 2026-07-30 01:44:50 +02:00
Agent Zero 49c8b740e4 fix: system admin bypasses workspace filter in sidebar 2026-07-30 01:25:29 +02:00
Agent Zero 8d5f272ba5 fix: deploy.py RLS exclude list reduced to 35 system tables only 2026-07-30 01:00:59 +02:00
Agent Zero 7f872b8bfc fix: deploy.py exclude system tables from RLS enforcement 2026-07-30 00:51:16 +02:00
Agent Zero d4ffbeca50 phase12: disable RLS on all system/auth/config/plugin tables (final migration) 2026-07-30 00:47:43 +02:00
Agent Zero 8833444dcb phase12: disable RLS on audit_log and sessions (written during login) 2026-07-30 00:20:20 +02:00
Agent Zero 02af9ebaa2 phase12: disable RLS on all system/auth/config tables for crm_api startup 2026-07-30 00:15:58 +02:00