Bug: testConnection() broken event dispatch and missing CSRF/ACL #107

Closed
opened 2026-06-06 11:50:06 +00:00 by jmiller · 1 comment
Owner

Audit Findings

Severity: Critical

Problem 1: Broken event dispatch pattern

ServiceController::testConnection() uses old-style [&$servicePlugins] pass-by-reference event dispatch, but all service plugins use Joomla 5+ SubscriberInterface which writes to Event ArrayAccess indices starting at 1. The $servicePlugins array remains empty — testConnection never finds any plugin and always fails.

Problem 2: Missing CSRF and ACL checks

No $this->checkToken() and no authorise() check. Any authenticated backend user can trigger API calls to external services.

Fix:

  1. Use Event ArrayAccess reading pattern (same as QueueProcessor::getServicePluginMap())
  2. Add $this->checkToken() and core.manage ACL check

Files: ServiceController.php

## Audit Findings **Severity:** Critical ### Problem 1: Broken event dispatch pattern `ServiceController::testConnection()` uses old-style `[&$servicePlugins]` pass-by-reference event dispatch, but all service plugins use Joomla 5+ `SubscriberInterface` which writes to Event ArrayAccess indices starting at 1. The `$servicePlugins` array remains empty — **testConnection never finds any plugin and always fails**. ### Problem 2: Missing CSRF and ACL checks No `$this->checkToken()` and no `authorise()` check. Any authenticated backend user can trigger API calls to external services. **Fix:** 1. Use Event ArrayAccess reading pattern (same as `QueueProcessor::getServicePluginMap()`) 2. Add `$this->checkToken()` and `core.manage` ACL check **Files:** `ServiceController.php`
Author
Owner

Branch created: feature/107-bug-testconnection-broken-event-dispatch

git fetch origin
git checkout feature/107-bug-testconnection-broken-event-dispatch
Branch created: [`feature/107-bug-testconnection-broken-event-dispatch`](https://git.mokoconsulting.tech/MokoConsulting/MokoJoomCross/src/branch/feature/107-bug-testconnection-broken-event-dispatch) ```bash git fetch origin git checkout feature/107-bug-testconnection-broken-event-dispatch ```
Sign in to join this conversation.