Commit Graph

808 Commits

Author SHA1 Message Date
Agent Zero 3032ad2cbf gate4: migration 0088 — auth RLS policies for password_reset_tokens and audit_log 2026-07-31 12:04:27 +02:00
Agent Zero a303a4e455 gate4: use separate API session for audit log in confirm_password_reset 2026-07-31 12:01:11 +02:00
Agent Zero a721db5214 gate4: set tenant context before audit log in confirm_password_reset 2026-07-31 11:58:11 +02:00
Agent Zero ce0e9ab12a gate4: fix SMTP TLS mode for port 465 (implicit TLS instead of STARTTLS) 2026-07-31 11:37:11 +02:00
Agent Zero 31408670e6 gate4: register app.core.jobs in worker for send_password_reset_email 2026-07-31 11:32:47 +02:00
Agent Zero ebc63beeb4 gate1: fix npm peer dependency conflict with --legacy-peer-deps 2026-07-31 11:19:53 +02:00
Agent Zero f1ce130a45 gate1: fix Dockerfile npm ci error suppression to show build errors 2026-07-31 11:18:29 +02:00
Agent Zero 044336a56d gate: final acceptance report for Phase 0 + Phase 1 with all gate items 2026-07-31 09:45:45 +02:00
Agent Zero fa96466a50 gate: fresh session per plugin activation to isolate RLS errors 2026-07-31 09:43:29 +02:00
Agent Zero ab8d878bc7 gate: db.expunge_all() after rollback to clear pending objects from failed INSERTs 2026-07-31 09:41:32 +02:00
Agent Zero d114fd7d4c gate: wrap db.commit() in try/except after plugin activation 2026-07-31 09:39:45 +02:00
Agent Zero 79d132b66d gate: fully resilient plugin activation in API startup 2026-07-31 09:37:44 +02:00
Agent Zero 01aa31a3e0 gate: API startup resilient to RLS errors, dont fail on duplicate cron job inserts 2026-07-31 09:33:41 +02:00
Agent Zero 31d11efd33 gate: API main.py flush+rollback after plugin activation for RLS error handling 2026-07-31 09:32:15 +02:00
Agent Zero 9d7b160e2a gate: fix password_reset RLS policy for crm_auth, set tenant context before token creation 2026-07-31 09:24:04 +02:00
Agent Zero 437c107ee8 gate: migration 0087 add timestamps to password_reset_tokens, backup uploaded to Forgejo 2026-07-31 09:23:34 +02:00
Agent Zero 1deb852ff3 gate: worker skips plugin activation, only registers event handlers
Check Cross-Plugin Imports / check (push) Has been cancelled
phase1-backup
2026-07-31 09:20:54 +02:00
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 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