diff --git a/administrator/components/com_contenthistory/src/Model/CompareModel.php b/administrator/components/com_contenthistory/src/Model/CompareModel.php index 25b3268de970a..50d445b654caa 100644 --- a/administrator/components/com_contenthistory/src/Model/CompareModel.php +++ b/administrator/components/com_contenthistory/src/Model/CompareModel.php @@ -85,8 +85,10 @@ public function getItems() $user = $this->getCurrentUser(); // Access check - if (!$user->authorise('core.edit', $table1->item_id) && !$this->canEdit($table1)) { - throw new NotAllowed(Text::_('JERROR_ALERTNOAUTHOR'), 403); + foreach ([$table1, $table2] as $table) { + if (!$user->authorise('core.edit', $table->item_id) && !$this->canEdit($table)) { + throw new NotAllowed(Text::_('JERROR_ALERTNOAUTHOR'), 403); + } } $nullDate = $this->getDatabase()->getNullDate(); diff --git a/administrator/components/com_joomlaupdate/config.xml b/administrator/components/com_joomlaupdate/config.xml index c2156111baae9..920f6401b009e 100644 --- a/administrator/components/com_joomlaupdate/config.xml +++ b/administrator/components/com_joomlaupdate/config.xml @@ -45,6 +45,7 @@ length="50" showon="updatesource:custom" validate="url" + schemes="http,https,ftp,ftps" /> subject, ENT_COMPAT, 'UTF-8'); + $subject = strip_tags(html_entity_decode($table->subject, ENT_COMPAT, 'UTF-8')); $message = strip_tags(html_entity_decode($table->message, ENT_COMPAT, 'UTF-8')); // Send the email @@ -399,6 +399,7 @@ public function save($data) $mailer->addTemplateData($data); $mailer->setReplyTo($fromUser->email, $fromUser->name); $mailer->addRecipient($toUser->email, $toUser->name); + $mailer->addUnsafeTags(['fromname']); try { $mailer->send(); diff --git a/administrator/components/com_modules/tmpl/modules/default.php b/administrator/components/com_modules/tmpl/modules/default.php index 679f51614f2f1..993888bcbb000 100644 --- a/administrator/components/com_modules/tmpl/modules/default.php +++ b/administrator/components/com_modules/tmpl/modules/default.php @@ -107,7 +107,7 @@ $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || is_null($item->checked_out); $canChange = $user->authorise('core.edit.state', 'com_modules.module.' . $item->id) && $canCheckin; ?> - + id, false, 'cid', 'cb', $item->title); ?> diff --git a/administrator/components/com_newsfeeds/forms/newsfeed.xml b/administrator/components/com_newsfeeds/forms/newsfeed.xml index cb0b9bdced79f..0f7b04d8a7e81 100644 --- a/administrator/components/com_newsfeeds/forms/newsfeed.xml +++ b/administrator/components/com_newsfeeds/forms/newsfeed.xml @@ -89,6 +89,7 @@ required="true" filter="url" validate="url" + schemes="http,https" /> set('com_users.mfa_checked', 1); $session->set('com_users.mandatory_mfa_setup', 0); + // If the Remember Me cookie was deferred pending MFA, create it now that MFA has been passed + if ($session->get('com_users.remember_deferred', 0)) { + $session->set('com_users.remember_deferred', 0); + + $plugin = PluginHelper::getPlugin('authentication', 'cookie'); + + // Only mint the cookie when the cookie authentication plugin is enabled + if ($plugin && $this->app->isClient('site')) { + $user = $this->app->getIdentity() ?: $this->getUserFactory()->loadUserById(0); + + RememberMe::createOrUpdateCookie( + $user, + $this->app, + Factory::getContainer()->get(DatabaseInterface::class), + new Registry($plugin->params ?? '') + ); + } + } + // Get the return URL stored by the plugin in the session $returnUrl = $session->get('com_users.return_url', ''); diff --git a/administrator/components/com_users/src/Helper/Mfa.php b/administrator/components/com_users/src/Helper/Mfa.php index ea4e4ca4e1195..cbba09b1776eb 100644 --- a/administrator/components/com_users/src/Helper/Mfa.php +++ b/administrator/components/com_users/src/Helper/Mfa.php @@ -319,6 +319,40 @@ function ($record) use (&$hasBackupCodes) { return $records; } + /** + * Could the user still owe a Multi-factor Authentication step after their password login? + * + * This is a conservative check used to decide whether issuing a persistent credential + * (e.g. a Remember Me cookie) must be deferred until the login is fully complete. It + * returns true when the user either has MFA records or belongs to a user group which + * enforces MFA setup. The final decision on whether the captive MFA page or the + * mandatory setup page is actually shown lies with the MultiFactorAuthenticationHandler. + * + * @param User $user The user to check + * + * @return boolean + * @throws \Exception + * + * @since 6.1.4 + */ + public static function userMayNeedMfaGate(User $user): bool + { + if ($user->guest) { + return false; + } + + // The user has MFA records, so the captive MFA page may apply. + if (\count(self::getUserMfaRecords((int) $user->id))) { + return true; + } + + // The user is in a group which enforces MFA, so the mandatory setup page may apply. + $forceMFAUserGroups = ComponentHelper::getParams('com_users')->get('forceMFAUserGroups', []); + $forceMFAUserGroups = \is_array($forceMFAUserGroups) ? $forceMFAUserGroups : []; + + return \count(array_intersect($forceMFAUserGroups, $user->getAuthorisedGroups())) >= 1; + } + /** * Are the conditions for showing the MFA configuration interface met? * diff --git a/administrator/components/com_users/src/Model/UserModel.php b/administrator/components/com_users/src/Model/UserModel.php index b59fc1e8671b9..85c7b9af45b52 100644 --- a/administrator/components/com_users/src/Model/UserModel.php +++ b/administrator/components/com_users/src/Model/UserModel.php @@ -553,6 +553,7 @@ public function activate(&$pks) ); $mailer->addTemplateData($mailData); $mailer->addRecipient($userData['email']); + $mailer->addUnsafeTags(['username', 'name']); try { $return = $mailer->send(); diff --git a/administrator/modules/mod_feed/mod_feed.xml b/administrator/modules/mod_feed/mod_feed.xml index fafc901502bd2..b07bd03c12a19 100644 --- a/administrator/modules/mod_feed/mod_feed.xml +++ b/administrator/modules/mod_feed/mod_feed.xml @@ -30,6 +30,7 @@ filter="url" required="true" validate="url" + schemes="http,https" /> addRecipient($contact->email_to); $mailer->setReplyTo($templateData['email'], $templateData['name']); $mailer->addTemplateData($templateData); + $mailer->addUnsafeTags(['name', 'email', 'body']); $sent = $mailer->send(); // If we are supposed to copy the sender, do so. @@ -260,6 +261,7 @@ private function _sendEmail($data, $contact, $emailCopyToSender) $mailer->addRecipient($templateData['email']); $mailer->setReplyTo($templateData['email'], $templateData['name']); $mailer->addTemplateData($templateData); + $mailer->addUnsafeTags(['name', 'email', 'body']); $sent = $mailer->send(); } } catch (MailDisabledException | phpMailerException $exception) { diff --git a/api/components/com_users/src/Controller/GroupsController.php b/api/components/com_users/src/Controller/GroupsController.php index 4d55cd5b3827c..a777373cc53be 100644 --- a/api/components/com_users/src/Controller/GroupsController.php +++ b/api/components/com_users/src/Controller/GroupsController.php @@ -68,7 +68,7 @@ public function delete($id = null) * * @since 6.1.1 */ - public function allowAdd($data = []) + protected function allowAdd($data = []) { // Overrides the default behavior to check the core.admin permission. return $this->app->getIdentity()->authorise('core.admin', $this->option); @@ -84,7 +84,7 @@ public function allowAdd($data = []) * * @since 6.1.1 */ - public function allowEdit($data = [], $key = 'id') + protected function allowEdit($data = [], $key = 'id') { // Overrides the default behavior to check the core.admin permission. return $this->app->getIdentity()->authorise('core.admin', $this->option); diff --git a/api/components/com_users/src/Controller/LevelsController.php b/api/components/com_users/src/Controller/LevelsController.php index 65ffeac9c231c..e87418e78ff99 100644 --- a/api/components/com_users/src/Controller/LevelsController.php +++ b/api/components/com_users/src/Controller/LevelsController.php @@ -56,4 +56,48 @@ protected function preprocessSaveData(array $data): array return $data; } + + /** + * Method to check if it's allowed to delete a record + * + * @return boolean + * + * @since 6.1.4 + */ + protected function allowDelete(): bool + { + // Overrides the default behavior to check the core.admin permission. + return $this->app->getIdentity()->authorise('core.admin', $this->option); + } + + /** + * Method to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 6.1.4 + */ + protected function allowAdd($data = []) + { + // Overrides the default behavior to check the core.admin permission. + return $this->app->getIdentity()->authorise('core.admin', $this->option); + } + + /** + * Method to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key; default is id. + * + * @return boolean + * + * @since 6.1.4 + */ + protected function allowEdit($data = [], $key = 'id') + { + // Overrides the default behavior to check the core.admin permission. + return $this->app->getIdentity()->authorise('core.admin', $this->option); + } } diff --git a/components/com_users/src/Controller/ProfileController.php b/components/com_users/src/Controller/ProfileController.php index 50a6652559ba7..82bbb4d613116 100644 --- a/components/com_users/src/Controller/ProfileController.php +++ b/components/com_users/src/Controller/ProfileController.php @@ -90,6 +90,11 @@ public function save() $user = $this->app->getIdentity(); $userId = (int) $user->id; + // Only allow logged in Users + if ($user->guest) { + throw new \RuntimeException(Text::_('JERROR_ALERTNOAUTHOR'), 403); + } + // Get the user data. $requestData = $app->getInput()->post->get('jform', [], 'array'); diff --git a/components/com_users/src/Model/RegistrationModel.php b/components/com_users/src/Model/RegistrationModel.php index b859a33fe8157..c413b323f3ef3 100644 --- a/components/com_users/src/Model/RegistrationModel.php +++ b/components/com_users/src/Model/RegistrationModel.php @@ -197,6 +197,7 @@ public function activate($token) ); $mailer->addTemplateData($data); $mailer->addRecipient($row->email); + $mailer->addUnsafeTags(['username', 'name']); $return = $mailer->send(); } catch (\Exception $exception) { try { @@ -239,6 +240,7 @@ public function activate($token) ); $mailer->addTemplateData($data); $mailer->addRecipient($data['email']); + $mailer->addUnsafeTags(['username', 'name']); try { $return = $mailer->send(); diff --git a/components/com_users/src/Model/RemindModel.php b/components/com_users/src/Model/RemindModel.php index 5df7325a82db3..207fb5559ca27 100644 --- a/components/com_users/src/Model/RemindModel.php +++ b/components/com_users/src/Model/RemindModel.php @@ -186,6 +186,7 @@ public function processRemindRequest($data) ); $mailer->addTemplateData($data); $mailer->addRecipient($user->email, $user->name); + $mailer->addUnsafeTags(['username', 'name']); // Try to send the password reset request email. try { diff --git a/components/com_users/src/Model/ResetModel.php b/components/com_users/src/Model/ResetModel.php index 1cd5986d19418..cab74508ac98c 100644 --- a/components/com_users/src/Model/ResetModel.php +++ b/components/com_users/src/Model/ResetModel.php @@ -475,6 +475,7 @@ public function processResetRequest($data) ); $mailer->addTemplateData($data); $mailer->addRecipient($user->email, $user->name); + $mailer->addUnsafeTags(['username', 'name']); // Try to send the password reset request email. try { diff --git a/composer.lock b/composer.lock index 7d93aded1631c..dcb8009ac97de 100644 --- a/composer.lock +++ b/composer.lock @@ -1677,16 +1677,16 @@ }, { "name": "joomla/filter", - "version": "4.1.0", + "version": "4.1.1", "source": { "type": "git", "url": "https://github.com/joomla-framework/filter.git", - "reference": "f61782cddb50f3d27a970b355ac1712bc6b16689" + "reference": "b5c74c37d07790060867d4091673b73d555fda90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/joomla-framework/filter/zipball/f61782cddb50f3d27a970b355ac1712bc6b16689", - "reference": "f61782cddb50f3d27a970b355ac1712bc6b16689", + "url": "https://api.github.com/repos/joomla-framework/filter/zipball/b5c74c37d07790060867d4091673b73d555fda90", + "reference": "b5c74c37d07790060867d4091673b73d555fda90", "shasum": "" }, "require": { @@ -1697,8 +1697,8 @@ "joomla/language": "^4.0", "phpstan/phpstan": "^2.1.17", "phpstan/phpstan-deprecation-rules": "^2.0.3", - "phpunit/phpunit": "^12.2.7", - "squizlabs/php_codesniffer": "^3.7.2" + "phpunit/phpunit": "^12.5 || ^13.0", + "squizlabs/php_codesniffer": "^4.0" }, "suggest": { "joomla/language": "Required only if you want to use `OutputFilter::stringURLSafe`." @@ -1722,9 +1722,9 @@ ], "support": { "issues": "https://github.com/joomla-framework/filter/issues", - "source": "https://github.com/joomla-framework/filter/tree/4.1.0" + "source": "https://github.com/joomla-framework/filter/tree/4.1.1" }, - "time": "2026-08-14T10:06:10+00:00" + "time": "2026-09-29T16:02:01+00:00" }, { "name": "joomla/http", @@ -9647,9 +9647,9 @@ "ext-gd": "*", "ext-dom": "*" }, - "platform-dev": {}, + "platform-dev": [], "platform-overrides": { "php": "8.3.0" }, - "plugin-api-version": "2.9.0" + "plugin-api-version": "2.6.0" } diff --git a/layouts/joomla/html/audio.php b/layouts/joomla/html/audio.php index 225b20f4cb60c..5b9f05528d164 100644 --- a/layouts/joomla/html/audio.php +++ b/layouts/joomla/html/audio.php @@ -19,8 +19,15 @@ use Joomla\Utilities\ArrayHelper; -if (array_key_exists('src', $displayData) && !empty($displayData['src'])) { - $displayData['src'] = $this->escape($displayData['src']); +$attributes = []; + +foreach ($displayData as $attributeName => $attributeValue) { + // Skip invalid attribute names + if (!preg_match('/^[a-zA-Z][a-zA-Z0-9_:.-]*$/', $attributeName)) { + continue; + } + + $attributes[$attributeName] = htmlspecialchars((string) $attributeValue, ENT_QUOTES, 'UTF-8'); } -echo ''; +echo ''; diff --git a/layouts/joomla/html/video.php b/layouts/joomla/html/video.php index e6f2afa5a1000..847a15d50458b 100644 --- a/layouts/joomla/html/video.php +++ b/layouts/joomla/html/video.php @@ -21,20 +21,27 @@ use Joomla\Utilities\ArrayHelper; -if (array_key_exists('src', $displayData) && !empty($displayData['src'])) { - $displayData['src'] = $this->escape($displayData['src']); -} - $source = []; if (isset($displayData['source']) && is_array($displayData['source'])) { $source = $displayData['source']; unset($displayData['source']); } -echo '