Commit Graph

652 Commits

Author SHA1 Message Date
Agent Zero 11ffffcb44 feat: SmartSuite-style SortPanel with multi-field priority sorting, all contact fields 2026-07-28 10:26:22 +02:00
Agent Zero e95875464b feat: SmartSuite-style FilterPanel with multi-condition AND/OR, all contact fields, context-sensitive ordering 2026-07-28 09:19:02 +02:00
Agent Zero 7962d34fcf toolbar: unified filter+sort dropdown with sections, fixed positioning, iconOnly support 2026-07-28 02:16:03 +02:00
Agent Zero bbaded656f fix: toolbar dropdown z-index and overflow for visibility 2026-07-28 00:50:39 +02:00
Agent Zero 722335c923 contacts toolbar: consolidate views and filters into dropdowns 2026-07-28 00:45:55 +02:00
Agent Zero 5378372aba security: remove hardcoded credentials from scripts and docs 2026-07-28 00:35:09 +02:00
Agent Zero 106f888cb9 feat: add fast-deploy.sh for quick frontend-only deploys (~20s) 2026-07-28 00:03:31 +02:00
Agent Zero e1e7405821 fix: match mail folder tree styling - remove min-h-touch, font-medium only on active, motion-safe transition 2026-07-27 23:55:01 +02:00
Agent Zero ee38b200f8 fix: tighten folder tree spacing + collapsible search icon in toolbar 2026-07-27 23:46:16 +02:00
Agent Zero 9a922f8abb feat: color picker panel with 18 preset colors + native color input + hex field 2026-07-27 17:31:42 +02:00
Agent Zero c670084420 fix: dropdown as portal in document.body with z-9999 — no longer hidden by sidebar 2026-07-27 17:22:24 +02:00
Agent Zero 01040201ef fix: button as sibling of draggable div — desktop drag no longer blocks click 2026-07-27 17:10:00 +02:00
Agent Zero 4a3e4cd0a4 fix: restore drag-and-drop + onPointerDown stopPropagation on button — both work on all resolutions 2026-07-27 16:57:48 +02:00
Agent Zero 4c951c9c61 fix: remove draggable from folder item — button click works on all resolutions 2026-07-27 16:48:49 +02:00
Agent Zero 470e183ade fix: button in normal flow, only inner span draggable — fixes dropdown position and icon shift 2026-07-27 16:35:13 +02:00
Agent Zero bb48793217 fix: move more-options button outside draggable div to fix click
- Button was inside draggable div — browser started drag instead of click
- Button is now absolutely positioned outside the draggable div
- Outer div has position:relative for correct button placement
- Spacer span reserves space for the button in the layout
- Works on all screen sizes (desktop, tablet, mobile)
2026-07-27 16:28:24 +02:00
Agent Zero 75505ab5bf fix: folder dropdown button not working — drag interference + button too small
- Button: draggable={false}, onMouseDown stopPropagation prevents drag swallow
- Button: larger (p-1.5, w-4 h-4), opacity-70, rounded hover bg
- Parent onDragStart: checks if target is Optionen button, prevents drag
- handleMoreClick: currentTarget fallback to closest('button')
- type='button' prevents accidental form submit
2026-07-27 15:58:48 +02:00
Agent Zero 81ff27b76a feat: contact folder drag-and-drop, mobile dropdown, folder-in-folder move
- Folders are draggable: drag folder into another folder (parent_id update)
- Circular reference prevention: isDescendantOrSelf() check
- Root drop zone: drag folder to root unparents it (parent_id=null)
- MoreVertical button: opacity-60 for mobile visibility (was opacity-0)
- Dropdown: viewport-clamped positioning + maxHeight with scroll
- ContactList already had draggable contacts (no changes needed)
2026-07-27 14:32:42 +02:00
Agent Zero 719ee251f2 fix: close remaining security gaps, test fixes, frontend integration, event bus
Check Cross-Plugin Imports / check (push) Has been cancelled
- RCE: move _check_dangerous_imports() BEFORE exec_module() in plugins.py
- verify_ws_origin: reject empty Origin header when CORS configured
- Test: ai_app fixture with permission_registry init for ai_assistant
- Test: login_client sets CSRF token + Origin as client default headers
- Test: SESSION_COOKIE_SECURE=false override + get_settings.cache_clear()
- Test: asyncio_default_test_loop_scope=session fixes event loop closed
- Test: fix 15 assertions (paths, variables, auth expectations)
- Frontend: integrate SavedFilterBar in ContactsList, Mail, Calendar
- Frontend: integrate TagSelector in ContactsList, Mail, Calendar
- Event Bus: add 4 subscribers in system_notif (conversation/participant/reaction)
- Docs: update all analysis reports and FIX-PLAN-V2 to current state
2026-07-27 12:45:45 +02:00
Agent Zero 1916243d36 fix: restore drag-and-drop in ContactFolderTree with dropdown menu (rename/color/pin/delete) 2026-07-27 09:52:55 +02:00
Agent Zero 47dfdfb794 fix: ContactFolderTree drag-drop removed, dropdown menu with rename/color/pin/delete; ContactsList toolbar moved to plugin toolbar 2026-07-27 09:47:22 +02:00
Agent Zero b24ac6883f fix: remove wrap_plugin_route — it broke ForwardRef resolution for body params
wrap_plugin_route copied __signature__ from the original handler but
the wrapper's __globals__ namespace (plugin_error_handler.py) did not
contain the Pydantic models (ConversationCreate, MessageCreate, etc.).
FastAPI could not resolve ForwardRef('ConversationCreate') → 422 on
all POST routes with body parameters.

Removing the wrapper entirely fixes this. Plugin error isolation can
be re-added later using a different approach (middleware or exception handler).
2026-07-27 02:51:20 +02:00
Agent Zero 24fb384cf9 fix: keep __annotations__ in wrap_plugin_route — body params need ForwardRef resolution
Removing __annotations__ broke body parameter resolution: FastAPI could
not resolve ForwardRef('ConversationCreate') etc. causing 422 on all
POST routes with body params. Now keeping annotations from functools.wraps
and only removing return_annotation.
2026-07-27 02:39:16 +02:00
Agent Zero d607803e86 fix: WebSocket 403 — SameSite=Strict blocked session cookie on WS connections
Check Cross-Plugin Imports / check (push) Has been cancelled
Root cause: session_cookie_samesite was 'strict' which prevents the
browser from sending the session cookie on WebSocket upgrade requests.
Changed to 'lax' which allows WebSocket cookies while still blocking
cross-site POST CSRF attacks.

Also removed debug logging from kommunikation routes.
2026-07-27 02:23:25 +02:00
Agent Zero 35a9ce1e7b debug: add WebSocket connection logging to find 403 cause
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-07-27 02:18:49 +02:00
Agent Zero d0ae93a422 fix: WebSocket 403 — per-route require_active_plugin instead of router-level
Router-level dependencies=[Depends(require_active_plugin)] was applied
to ALL routes including WebSocket. Now adding the dependency per-HTTP-route
only, WebSocket routes are skipped entirely.
2026-07-27 01:48:18 +02:00
Agent Zero b281c541b2 fix: remove Request param from _check() — WebSocket can't resolve Request dependency
The Request parameter caused TypeError on WebSocket routes because
FastAPI cannot inject Request into WebSocket scope. Reverted to
parameterless _check(). WebSocket 403 is handled by CSRF middleware
which already skips WebSocket upgrade requests.
2026-07-27 01:45:08 +02:00
Agent Zero 0c67eb0754 fix: WebSocket 403 — require_active_plugin skips WebSocket requests
Simpler approach: require_active_plugin._check() now accepts Request
parameter and returns early for WebSocket upgrade requests.
No route splitting needed — all routes stay in their original router.
2026-07-27 01:34:50 +02:00
Agent Zero aae3dc2297 fix: add missing APIRouter import for WebSocket route registration 2026-07-27 01:26:26 +02:00
Agent Zero 00180f8f7d fix: WebSocket 403 — register WebSocket routes without require_active_plugin dependency
WebSocket routes were getting require_active_plugin dependency applied
via include_router(dependencies=[...]) which caused 403 Forbidden
before the WebSocket upgrade could happen.

Fix: Split router into HTTP routes (with dependency) and WebSocket routes
(registered separately without the active-plugin check). WebSocket auth
is handled inside the endpoint itself via session cookie verification.
2026-07-27 01:23:07 +02:00
Agent Zero 7968630840 fix: UploadFile ForwardRef + WebSocket 403 — root cause fixed
1. plugin_error_handler.py: Remove _UploadFile alias, import UploadFile directly
   so FastAPI can resolve ForwardRef('UploadFile') in the wrapper's namespace.
   Also import WebSocket for ForwardRef resolution.

2. main.py: Skip WebSocket routes in wrap_plugin_route — WebSocket endpoints
   must not be wrapped (different protocol, no JSONResponse on error)
2026-07-27 01:17:59 +02:00
Agent Zero 09cd1a5fe2 fix: UploadFile ForwardRef error + WebSocket 403 CSRF block
1. plugin_error_handler.py: Remove return_annotation from copied signature
   to prevent FastAPI ForwardRef('UploadFile') resolution failure on routes
   with file upload endpoints (dms, calendar, mail, kommunikation, ai_assistant)

2. middleware.py: Skip CSRF check for WebSocket upgrade requests
   WebSocket connections use GET with upgrade header — should not be
   blocked by CSRF middleware
2026-07-27 01:08:51 +02:00
Agent Zero 1c01bbccb7 fix: 422 errors on all plugin routes — wrapper(*args, **kwargs) was interpreted as query params by FastAPI
The wrap_plugin_route wrapper had *args, **kwargs as parameters.
FastAPI interpreted these as required query parameters 'args' and 'kwargs',
causing 422 Unprocessable Entity on EVERY plugin route (mail, calendar, dms, reports, etc.).

Fix: Use functools.wraps(handler) to copy the original signature,
then remove __annotations__ (to avoid ForwardRef('UploadFile') issues),
and manually set __signature__ from the original handler.
2026-07-27 01:02:10 +02:00
Agent Zero ece3cdf75a feat: report ALL errors to Forgejo — backend 4xx/5xx, unhandled exceptions, worker job failures
- main.py: RequestLoggingMiddleware reports 4xx/5xx responses and unhandled exceptions to Forgejo
- worker.py: Plugin activation failures and outbox job failures reported to Forgejo
- 401/403 are NOT reported (expected auth/permission behavior)
- All other errors (422, 404, 500, network, worker) ARE reported
2026-07-27 00:36:37 +02:00
Agent Zero 1ba702f6fe fix: report API errors (422, 404, 5xx, network) and React errors to Forgejo error reporter
- client.ts: logError() import added, API error interceptor now reports to /api/v1/errors
- ErrorBoundary.tsx: logError() import added, React rendering errors now reported
- 401 (auth) and 403 (permission) errors are NOT reported (expected behavior)
- 422 (validation), 404 (not found), 5xx (server), 0 (network) ARE reported
2026-07-26 23:45:59 +02:00
Agent Zero 99643d25ab fix: worker healthcheck — Redis ping instead of HTTP check for worker container 2026-07-26 23:31:07 +02:00
Agent Zero 98eb1d0d89 feat: Plugin-System Umbau — 6 Phasen komplett abgeschlossen
Check Cross-Plugin Imports / check (push) Has been cancelled
Phase 1: Contracts konsequent nutzen
- 12 neue contracts.py erstellt (alle 19 Plugins haben jetzt contracts)
- 4 bestehende contracts.py an zentrale ContractRegistry angepasst
- Alle 19 Plugins haben on_deactivate mit Contract-Unregister
- 0 echte problematische INTER-Plugin Imports

Phase 2: Hooks/Filters-System
- app/core/hooks.py (HookRegistry mit actions + filters)
- 15 Hook-Punkte in Core-Services (contact, auth, mail, calendar, user, dms)
- BasePlugin.on_deactivate meldet alle Hooks ab

Phase 3: Plugin-Isolation
- scripts/check_cross_plugin_imports.py (Linting-Regel)
- .github/workflows/check-cross-plugin-imports.yml (CI/CD)
- .pre-commit-cross-plugin.yaml (Pre-commit Hook)
- 155 Dateien geprueft, 0 Verstoesse

Phase 4: Plugin-Versioning
- app/plugins/semver.py (SemVer mit Parse, Compare, Pre-release)
- migration_runner.py erweitert: run_migration_down, rollback_to_version
- manifest.py: min_app_version Feld
- registry.py: App-Version-Compatibility-Check bei Installation
- GET /api/v1/plugins/updates Endpoint

Phase 5: Marketplace-Vorbereitung
- app/plugins/signature.py (Ed25519 Signatur-Validierung)
- app/plugins/quarantine.py (Plugin-Quarantine mit Validierung)
- app/models/plugin_allowlist.py + Migration 0046
- manifest.py: author, license, homepage, icon, screenshots, changelog, marketplace_tags, price
- registry.py: discover_external(), discover_all()
- POST /api/v1/plugins/install-marketplace (deaktiviert)

Phase 6: Manifest-Anpassung
- manifest.py: 12 neue Felder + SemVer/Hook-Name Validierung
- MANIFEST_SCHEMA_DOC aktualisiert
- Alle 19 Plugin-Manifeste aktualisiert
- Frontend PluginUiManifest Typ erweitert

Zusaetzliche Bug-Fixes:
- test_sample-Modul erstellt
- conftest.py Deadlock-Prevention
- SESSION_COOKIE_SECURE=true
- dump.rdb aus Git entfernt + .gitignore
- backup.py datetime.utcnow -> func.now()
- system_settings.py JSONB-Import nach oben
- tax.py Mapped[float] -> Mapped[Decimal]
- notification.py type_key-Laengen vereinheitlicht

Tests: 91 neue Tests, alle bestanden
2026-07-26 23:15:34 +02:00
Agent Zero 744d595cae Fix: deploy.py DB verification accepts alembic version >= 0045 2026-07-26 22:14:47 +02:00
Agent Zero d7eb610d76 Fix: require_active_plugin without get_current_user dependency — auth handled by individual routes 2026-07-26 21:46:02 +02:00
Agent Zero c11fdf58dc Fix: require_active_plugin needs Request param for get_current_user injection 2026-07-26 21:43:44 +02:00
Agent Zero a8b0043756 Fix: Migration 0044 down_revision must be 0043_backups not 0043 2026-07-26 21:41:23 +02:00
Agent Zero b6e3afd28b Phase 4 + M5: Low-priority fixes and frontend component integration
M5: TagBadge integrated into ContactDetail (replaces plain Badge)
M5: EntityHistoryPanel integrated into ContactDetail (timeline section)

L1: Replace document.write() with Blob URL in print.ts (XSS-safe)
L2: AI UI Control feedback storage capped at 100 entries (FIFO eviction)
L3: Backup & Restore documentation added to DEPLOY.md

Verified: Backend import OK, TypeScript 0 errors
2026-07-26 21:29:37 +02:00
Agent Zero 825d638130 Phase 3: Fix medium-priority issues (M1-M4, M6)
M1: Password complexity validation (min 8 chars, uppercase, lowercase, digit)
M2: Remove is_system_admin from login response (prevent role leaking)
M3: Permission cache invalidates on DB error instead of using stale data
M4: .env.docker.example already fixed in B9 (SECRET_KEY, FRONTEND_URL, SMTP)
M6: Frontend test setup auto-wraps with QueryClientProvider (fixes ~29 test failures)

Remaining: M5 (frontend component integration — WelcomeDialog, SavedFilterBar, etc.)
2026-07-26 20:51:40 +02:00
Agent Zero 604a2b7648 Phase 2: Fix high-priority security and stability issues (H1-H7)
H1: Sanitize error endpoint context (strip tokens/passwords, limit depth/size)
H2: Rate limiter IP spoofing fix (trusted proxy CIDR check for X-Forwarded-For)
H3: CSRF middleware uses Redis singleton instead of per-request connection
H4: WebSocket origin verification added to both kommunikation and ai_ui_control
H5: Storage path traversal protection, get_url() returns relative URL not filesystem path
H6: Security headers middleware (HSTS, X-Content-Type-Options, X-Frame-Options, CSP, Referrer-Policy)
H7: Forward-repair migration 0045 for databases that ran original 0021/0027

Also: add trusted_proxy_cidrs to config, add verify_ws_origin to auth
2026-07-26 20:49:15 +02:00
Agent Zero 5ec1fc9b05 Phase 1: Fix all critical release blockers (B1-B10)
B1: Remove duplicate get_redis() — singleton no longer overwritten
B2: Plugin routes now enforce activation status via require_active_plugin()
B3: Fix UploadFile ForwardRef error — remove functools.wraps from wrap_plugin_route
B4: DMS upload uses true streaming via save_stream() instead of RAM accumulation
B5: Worker on_startup registers plugin event handlers + webhook dispatcher
B6: Implement send_password_reset_email job, remove raw token logging
B7: Webhook SSRF protection (IP validation, no redirects), secret removed from response
B8: RLS repair migration 0044 + separate crm_runtime DB user (NOSUPERUSER, NOBYPASSRLS)
B9: Fix .env.docker.example AUTH_SECRET → SECRET_KEY
B10: Remove Redis default password, remove exposed DB/Redis ports

Also: add frontend_url to config, add SMTP settings to .env.docker.example,
update prestart.sh to use MIGRATION_DATABASE_URL for alembic.
2026-07-26 20:45:42 +02:00
Agent Zero 7a14973c68 chore: verify all FIX-PLAN items, remove completed, update status
- Verified all 22 FIX-PLAN items against codebase
- 20/22 items confirmed done (P0-1..P0-6, P1-1..P1-11, P2-1, P2-3, P2-4)
- Removed JWT vars from COOLIFY_SETUP.md (P1-10 final fix)
- Remaining: P0-7 (operational), P2-2 (228 cross-imports)
- Updated .a0/current_status.md and .a0/next_steps.md
2026-07-26 16:26:10 +02:00
Agent Zero a897bca390 fix: use label IDs instead of strings for Forgejo issue creation 2026-07-26 15:14:24 +02:00
Agent Zero 14967fc70b fix: remove unused Request param from forgejo error reporter status endpoint 2026-07-26 13:02:11 +02:00
Agent Zero 227ab7546b fix: add routes to forgejo_error_reporter plugin manifest 2026-07-26 12:57:19 +02:00
Agent Zero c3e41906bf feat: add forgejo_error_reporter plugin for automatic error reporting to Forgejo issues 2026-07-26 12:49:39 +02:00