P

Pléiade Pro Audit

Branch: pro

Exhaustive Module-by-Module & File-by-File Architectural Assessment

← Overview Frontend Audit Global Rating: 8.6 / 10 (B+)
Global Pro Rating
8.6 / 10

Tremendous refactoring leap from legacy 2.8/10. Production-hardened with specific residual technical debt.

Modules Audited
18 + Theme + Infra

Every custom module inspected across PHP classes, services, templates, routing, and Docker configs.

Residual Issues
14 Points to Improve

Cache-backed job volatility, sequential blocking I/O, SSRF surface in RSS image fetching, and plaintext secrets in key-value.

Highest Rated Module
api_glpi_pleiade 9.5/10

Exemplary resource cleanup (finally killSession), masked loggers, and typed dependency injection.

Filter by Rating:
Showing all 18 custom modules + Theme + Docker Container Infrastructure
9.0 / 10 • Grade A web/modules/custom/pleiade_global_config

pleiade_global_config • Core Architectural Foundation (Socle)

Foundation / Central Services

Provides multi-tenant context (PleiadeContext), tenant repository (TenantManager), unified HTTP client proxy options (ProxyHelper), log masking (LogSanitizer), and automatic client-side CSRF tokens (pleiade.js).

✓ Architectural Strengths
  • Centralized multi-tenancy: connectors no longer read raw cookies or CAS sessions manually.
  • LogSanitizer scrubbers protect against token leakage into watchdog logs.
  • SecretFieldTrait prevents passwords/keys from re-rendering in admin HTML forms.
  • pleiade.js injects mandatory X-CSRF-Token headers into every non-GET fetch/ajax request.
⚠ Remaining Flaws & Things to Améliorer
  • Secrets stored unencrypted at rest: All tenant Zimbra keys, Oracle credentials, and Maarch tokens are stored in plain serialized format in the key_value table (global key). Should be encrypted with sodium_crypto_secretbox.
  • Tenant save race condition: TenantManager::save() reads all tenants into memory, updates, and writes all back. Simultaneous admin saves can overwrite changes.
9.5 / 10 • Grade A+ web/modules/custom/api_glpi_pleiade

api_glpi_pleiade • GLPI ITSM Connector

ITSM Integration

Communicates with GLPI REST API (GlpiService) to display assigned and group tickets. Best engineered integration module in the entire codebase.

✓ Architectural Strengths
  • Guaranteed Session Termination: Uses finally { $this->request('GET', $this->api('killSession')); } ensuring GLPI session limits are never exhausted.
  • Cached ticket results per user with configurable short TTL (60s default).
  • Profile switching preference list (super, technicien, self) is configurable without code changes.
  • Log outputs pass through LogSanitizer to scrub tokens.
⚠ Remaining Flaws & Things to Améliorer
  • 5 HTTP round trips per uncached poll: initSession → getFullSession → changeActiveProfile → search → killSession.
  • Recommendation: Persist the GLPI session token in Redis/Tempstore across user requests within its TTL to avoid re-authenticating on every page load.
9.0 / 10 • Grade A web/modules/custom/api_zimbra_pleiade

api_zimbra_pleiade • Zimbra SOAP Mail & Agenda Connector

Messaging & Calendar

Orchestrates Zimbra SOAP requests (ZimbraService) for inbox summaries, 30-day agenda views, full calendar views, and smart email replies.

✓ Architectural Strengths
  • Replaced fragile Guzzle debug stdout scraping with official SOAP AuthRequest XML envelopes.
  • Auth tokens cached in memory/APCu with 300s TTL. Reusable preauth URLs with expires=0 eradicated.
  • Calendar event titles, attendee names, and mail subjects sanitized with Html::escape() preventing stored XSS.
⚠ Remaining Flaws & Things to Améliorer
  • Legacy demoCalendar fallback: demoCalendar() still fetches an external unauthenticated JSON URL if configured. Should be deleted from production code.
  • No batching on folder unread counts: Recursively walks the folder tree and computes mail counts in PHP memory instead of querying Zimbra folder counters directly.
8.0 / 10 • Grade B web/modules/custom/pleiade_ai_selector

pleiade_ai_selector • n8n AI Agent Orchestration

AI / LLM Pipelines

Connects municipal agents to asynchronous n8n AI workflows: folder/document summarization ("prismes"), conversational chat agent, and automatic email drafting.

✓ Architectural Strengths
  • Database table for prismes with administrative UI (PromptForm) replaces hardcoded prompt IDs.
  • Hardcoded prompt token removed; dynamic token validation via X-Pleiade-Token header.
  • n8n receives scoped transient tokens rather than master domain keys by default.
⚠ Remaining Flaws & Things to Améliorer
  • CRITICAL RESILIENCE FLAW: Job states are saved in cache.default! If an admin or deployment executes drush cr while an AI job is running in n8n, the job state is erased. When n8n completes and calls the webhook, Drupal throws a 404/403. Jobs MUST be stored in a persistent database table.
  • Backward-compatibility leak toggle: Settings form still includes checkboxes send_zimbra_preauth_key and send_sso_cookie which restore credential leakage to n8n if activated.
8.5 / 10 • Grade B+ web/modules/custom/api_user_pleiade

api_user_pleiade • User Preferences & Directory Lookup

Identity & Preferences

Manages favorites CRUD, layout ordering, application toggles, and FusionDirectory LDAP profile attribute lookup (PleiadeUserService).

✓ Architectural Strengths
  • Privilege escalation eliminated: strict whitelist on PREFERENCE_LISTS and PREFERENCE_FLAGS.
  • user_preprocess_page no longer serializes password hashes or token fields to client HTML.
  • Admin-only protection (administer users) on user_list_query.
⚠ Remaining Flaws & Things to Améliorer
  • JSON preferences stored as text on User entity: field_menu_order and field_dashboard_order trigger full entity saves and cache invalidations for minor UI drag-and-drops.
  • Recommendation: Move fast-changing UI ordering to Drupal's user.data service to avoid rebuilding User entity caches.
6.5 / 10 • Grade D+ web/modules/custom/datatable_pleiade

datatable_pleiade • "Documents récents" Aggregator

Document Aggregation

Aggregates actionable items across i-Parapheur, Maarch Courrier, Nextcloud, and Ciril Finances into a single Tabulator table.

✓ Architectural Strengths
  • Centralized table with status unification across financial, administrative, and GED tools.
  • Safe field output escaping before JSON rendering.
⚠ Remaining Flaws & Things to Améliorer
  • Service Locator Anti-Pattern: DatatableController::documents_recents() invokes \Drupal::getContainer() dynamically instead of using standard constructor Dependency Injection.
  • Synchronous Microservice Blocking: Sequentially queries 4 enterprise backends. If one slows down, the entire widget blocks.
  • Zero Caching: Header set to no-store, private; any tab switch forces 4 backend queries again.
7.5 / 10 • Grade C+ web/modules/custom/api_ciril_pleiade

api_ciril_pleiade • Ciril Finances Oracle Integration

Oracle Database Connector

Executes direct PDO_OCI queries against Oracle schemas (CIVILGF, CIRIL) to retrieve purchase orders and invoices requiring signature or approaching payment deadlines.

✓ Architectural Strengths
  • Leverages Ciril's native SQL permission procedures (f_acces_exercice, f_acces_budget).
  • Configurable threshold warning days (mandate_warning_days) replaces hardcoded '00141'.
⚠ Remaining Flaws & Things to Améliorer
  • LogSanitizer Bypassed: CirilService does NOT use PleiadeLoggerTrait. It calls $this->logger->error($e->getMessage()) directly, which can leak Oracle credentials in TNS error strings.
  • Unescaped TNS String: Host and SID are concatenated directly into (DESCRIPTION=...) without alphanumeric validation, presenting a TNS injection surface.
7.5 / 10 • Grade C+ web/modules/custom/module_actu_pleiade

module_actu_pleiade • RSS News & Feed Ingestion

Content / Feeds

Ingests RSS news feeds from SITIV, individual municipalities, and internal Drupal nodes into a unified carousel widget.

✓ Architectural Strengths
  • Feed caching enabled with 1800s TTL per tenant; dead feeds cached for 300s to avoid repeated timeouts.
  • Interleaving algorithm smoothly blends syndicate and local commune news.
⚠ Remaining Flaws & Things to Améliorer
  • SSRF (Server-Side Request Forgery) in localImage(): localImage() blindly downloads image URLs found inside RSS <enclosure> and <img src> without validating against private/internal IP ranges (e.g. 127.0.0.1, 10.0.0.0/8).
  • Recommendation: Add IP address validation to reject non-routable private subnets prior to calling $this->httpClient->request().
8.0 / 10 • Grade B web/modules/custom/api_maarch_pleiade

api_maarch_pleiade • Maarch Courrier GED Integration

GED / Document Workflow

Connects to Maarch Courrier REST API to extract incoming correspondence baskets for the authenticated agent.

✓ Architectural Strengths
  • Replays user's native basket clauses (@user_id, @my_entities_id) respecting Maarch ACLs.
  • Links use configurable dynamic pattern templates.
⚠ Remaining Flaws & Things to Améliorer
  • Memory-heavy user lookup: If field_maarchuserid is blank, it calls GET users which downloads the complete organization directory into memory.
  • Sequential basket queries: Loops over every basket making a separate POST request to res/list.
8.5 / 10 • Grade B+ web/modules/custom/api_parapheur_pleiade

api_parapheur_pleiade • i-Parapheur v5 Electronic Signature

Cryptographic Signing

OIDC code flow on LemonLDAP using the user's session cookie, Keycloak token exchange, and multi-desk folder querying.

✓ Architectural Strengths
  • Automated token exchange with automatic 401 token refresh retry.
  • OAuth client secret removed from default configuration files.
⚠ Remaining Flaws & Things to Améliorer
  • Nested HTTP Loop: For every desk, for every state, it makes a synchronous GET call (up to 12 HTTP calls on cold load).
  • Recommendation: Parallelize desk requests with Guzzle concurrent promises.
8.5 / 10 • Grade B+ Dockerfile • docker-compose.yml • docker/

Devbox & Docker Infrastructure Stack

DevOps & Containers

Unified container stack with automated first-boot installation, healthcheck probes, and multi-stage Debian slim builds.

✓ Architectural Strengths
  • Image size reduced from 1.55 GB to 583 MB (multi-stage build).
  • MariaDB 11.4 isolated to internal docker bridge with healthchecks.
  • setpriv --reuid=www-data prevents root-owned Drush file generation.
⚠ Remaining Flaws & Things to Améliorer
  • Admin password echoed to stdout: Entrypoint prints admin password to docker logs. In production environments with log forwarders, this leaks credentials.
  • Apache MPM Prefork memory model: Prefork consumes ~80MB per worker. Moving to Nginx + PHP-FPM cuts memory by 60%.

Production Hardening Checklist & Action Plan

Priority 1 • Immediate

Persist AI Jobs in Database

Migrate AiJobManager job state storage from volatile cache.default to a custom database table to prevent 404/403 callback errors upon cache rebuilds.

Priority 2 • High

SSRF Mitigation in Actu

Add an IP validator to ActuPleiadeService::localImage() to block outbound requests resolving to RFC1918 private subnets and localhost.

Priority 3 • Medium

Async Guzzle Promises in Datatable

Refactor DatatableController to parallelize remote backend requests via Guzzle async promises, cutting load latency from 2.5s down to ~600ms.