AI meta-generation AJAX endpoint lacks ACL check and HTTP error handling #99
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
MokoOG::onAjaxMokoog()(plg_system_mokoog/src/Extension/MokoOG.php:848-941) gates onisClient('administrator')+Session::checkToken()+ai_enabled, but performs noauthorise()capability check. Any authenticated back-end user — including low-privilege ones — can trigger outbound paid AI API calls and burn credits.Secondary issues in
callAiApi()(lines 901-941)$response->codeis never inspected; a 4xx/5xx body isjson_decode'd andtrim(... ?? '')returns'', so auth/rate-limit/quota failures surface as a silent blank result with no diagnostic.HttpFactory::getHttp()— a hung provider blocks the admin request indefinitely.Fix
$user->authorise('core.edit', 'com_content')(or a dedicatedmokoog.aiaction — see access.xml issue #95) before generating.$response->codeand surface a meaningful error / log non-200 responses.Severity
Security / cost-control (credit abuse) + reliability.
Branch created:
feature/99-ai-meta-generation-ajax-endpoint-lacks-aFixed in PR #109 (merged to
dev).onAjaxMokoognow requirescore.edit/core.createoncom_contentbefore generating;callAiApienforces a 20s timeout and throws on non-200 HTTP status instead of returning a silent empty string. Closing.