Commit Graph

404 Commits

Author SHA1 Message Date
Agent Zero ab61c81d2b gate: worker flush after plugin activation to detect swallowed RLS errors 2026-07-31 09:19:45 +02:00
Agent Zero ec0cf6f588 gate: worker resilient to RLS errors during plugin activation, use crm_worker engine 2026-07-31 09:12:42 +02:00
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 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 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 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 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 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 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 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 ee4b0de144 fix: /health/ready status mapping (up/down → ok/fail) 2026-07-29 23:25:56 +02:00
Agent Zero 32db1498ba fix: /health/ready dict handling 2026-07-29 23:23:52 +02:00
Agent Zero 3e9cfbef8a phase11: /health/live + /health/ready endpoints + monitoring docs + Prometheus metrics docs 2026-07-29 23:22:29 +02:00
Agent Zero a2c3f797f2 phase8: report generation isolated in worker (ARQ background job) + async endpoint + DMS output
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-07-29 23:10:50 +02:00
Agent Zero 4e2c888505 phase7: command pattern infrastructure (CommandHandler, UnitOfWork, RequestContext) + example CreateContactCommand 2026-07-29 23:00:38 +02:00
Agent Zero 54c275580f phase6: standardized event envelope (aggregate_type, aggregate_id, occurred_at, correlation_id, schema_version) + outbox_deliveries table 2026-07-29 22:50:27 +02:00
Agent Zero f1c025f2ef fix: workspaces router prefix /api/v1/workspaces 2026-07-29 18:36:40 +02:00
Agent Zero 2423053477 phase5: workspace backend — models, service, routes, migration 0072 2026-07-29 18:32:35 +02:00
Agent Zero 5e29b50bcc fix: storage.load() → storage.read() for attachment download 2026-07-29 17:55:33 +02:00
Agent Zero 8322adb73f phase4: entity_attachments table + DMS unified storage + attachment service rewritten + download via DMS 2026-07-29 17:52:55 +02:00
Agent Zero 481125e29e phase3: plugin routes static only (no dynamic registration) + require_active_plugin Redis cache + cache invalidation on activate/deactivate
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-07-29 17:40:40 +02:00
Agent Zero 0448962d08 fix: visibility.py Defense-in-Depth tenant_id filter + entity_permissions deleted_at migration + cross-tenant tests 2026-07-29 16:12:04 +02:00
Agent Zero f1a2484055 fix: WeasyPrint URL fetcher + attachment improvements + webhook error propagation + WebSocket conversation check + RLS disabled on system tables (bootstrap fix)
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-07-29 13:19:21 +02:00
Agent Zero 648d8d89d6 fix: outbox consumer_inbox idempotency logic + tenant_plugin_activation per-tenant check 2026-07-29 13:02:33 +02:00
Agent Zero fd1a170f31 fix: plugin duplicate route registration + prestart.sh Python instead of psql + SMTP in docker-compose
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-07-29 12:48:25 +02:00
Agent Zero de53bcff25 fix: guest_sessions Redis index for revocation + RLS on all tenant tables (migration 0064) 2026-07-29 12:46:50 +02:00
Agent Zero 8dacb739bd P1 fixes: outbox no_handlers, HTML sanitization, WebSocket plugin check, fail-closed plugin gate, plugin admin-only 2026-07-29 12:33:46 +02:00
Agent Zero 8539a6402c P1.6: secure guest invitation tokens (secrets.token_urlsafe + SHA-256 hash + one-time use + session revocation) 2026-07-29 12:30:00 +02:00
Agent Zero 26bf8d3a31 P0+P1 fixes: RCE sandbox, SQL injection, RLS tenant isolation, DB roles, test syntax, attachment, permission registry, membership check
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-07-29 12:28:08 +02:00
Agent Zero 81ae5b7cb6 fix: redis cache invalidation in permission service + permission check in entity_permissions route + upsert cache invalidation + remove TopBar quick-create 2026-07-29 10:45:45 +02:00
Agent Zero da76b4636e fix: require_permission decorator → Depends() in entity_permissions.py 2026-07-29 08:05:56 +02:00
Agent Zero 24690fb674 sprint20-23: tests + documentation + guest access + infrastructure + migrations 0059 2026-07-29 02:53:37 +02:00
Agent Zero ddf73ee42e sprint14-19: ABAC UI rule editor + permission templates + bulk share + analytics + delegation + resolution strategies + migrations 0056-0058 2026-07-29 02:47:03 +02:00
Agent Zero e0003b9384 sprint12+13: zentrale rechte settings page + ABAC engine backend (model, migration 0055, service, routes) 2026-07-29 02:42:16 +02:00
Agent Zero 2c14368b90 sprint10+11: AI permission filter + API token scopes + merge check + owner transfer service + auto-transfer on deactivation 2026-07-29 02:37:51 +02:00
Agent Zero 958e412152 sprint8: plugin entities owner_id migration 0054 + calendar owned_mixin
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-07-29 02:33:16 +02:00
Agent Zero 48b2dfdb11 sprint9: app visibility — sidebar permission filter + TopBar + ProtectedRoute + route guards
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-07-29 02:28:52 +02:00
Agent Zero 88c04286af sprint6+7: permission notifications + audit trail + notification entity filter + mail account permissions + migration 0053
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-07-29 02:18:17 +02:00
Agent Zero 71ed592aa2 sprint4+5: field-level permissions complete + universal ShareDialog frontend 2026-07-29 02:14:26 +02:00
Agent Zero b06aeeb720 sprint3: dashboard counts per user + import owner_id + export visibility filter 2026-07-29 02:11:29 +02:00
Agent Zero 517e1b6d8b sprint2+3: remaining services visibility filter + search provider permission-aware + dashboard route
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-07-29 02:05:14 +02:00
Agent Zero 9fc84b7905 sprint2: 8 services + 8 routes visibility filter + BaseSearchProvider + owned_mixin on models
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-07-29 01:52:47 +02:00
Agent Zero 479ee04834 sprint2: visibility filter + contact service access checks + contacts route integration 2026-07-29 01:38:18 +02:00