Repository navigation
Fix the findings of the code review - #332
Merged
Merged
Conversation
Bugs - The unblock mail is no longer sent with an empty token when the token can't be stored (or made). - Failed logins typed with the email address or in another case get the account's unblock mail (UserRepository::accountByLogin(), matched as accountExists() and Joomla do; none for a disabled account) and are marked handled by the account's successful login. - "All" in the list of the .htaccess file shows every entry, not none. - Without a notification address, blocks no longer log an error (and count nothing). - A block duration below 0 is unlimited everywhere, as BlockPolicy::realDuration() has it; the block form takes 0 or more minutes and a valid start. - A broken manifest cache no longer breaks the settings page. - The list controllers are BaseControllers: AdminController's tasks called methods the list models haven't got. - "Save"/"New" of the .htaccess form are offered by the permissions the save needs; the form validates with its own fields and stores the entry in canonical form. Hardening - TokenunblockModel::unblock() (no confirmation, no address check) is gone. - Hand-written <If> blocks in the block section are kept intact by every change and by the uninstallation. - README: what the delays can and can't do. - dependencies.yml runs composer without write permissions; only a check that found something opens the issue. Clean-up - Every setting's default is in Settings::Defaults, read with Settings::get()/int()/bool()/string() (a test checks the form both ways and that no code has a default of its own). - Lock files are named by LockHelper::file()/slot() in one place. - Form rules return their error instead of posting it. - Removed: HtaccessHelper::edit403Message()/remove403Message(), DateRule, UnblockTokenRepository::exists(), the dead block-state helpers of the .htaccess list view, the Itemid of the backend links; the component uses the library's Origin::name() and network masks. - An update which can't migrate the settings tells the administrator; known addresses are upserted; group notifications skip disabled accounts; the log sorts by severity; deploy.sh copies every language. Requirements and CI - PHP 8.2 is the minimum (install scripts, update server, composer, CI). - The database images of the matrix are pinned by digest (checked by the lint), PostgreSQL 15 instead of the end-of-life 12. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFJFMPAZ5sdZ5QCeaJpmfk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes all the findings of a review of the plugin, library, component, package and CI code. It has tests for each fix. Four larger refactors are left out on purpose and tracked as #328, #329, #330 and #331.
Bugs
UnblockTokenRepository::add()returnsnullwhen it fails, and the plugin used to mail…&token=anyway. It now sends no mail and logs an error. A failure ofrandom_bytes()is caught too.UserRepository::accountByLogin()matches asaccountExists()and Joomla do; a disabled account gets no mail. The account's successful login now also marks those failures as handled (markHandled()takes several names and ignores case).BlockPolicy::realDuration()already said. Before, the lookup took it for a block that was never active.BlockTable::check()refuses a duration below 0 minutes or one that isn't a whole number, and a start that isn't a date.manifest_cacheno longer throws a TypeError there (VersionHelper::getVersion()).BaseControllers now. Thepublish,delete,checkin… tasks they inherited fromAdminControllercalled methods the list models don't have.HtblockController::mayAdd(): core.create and core.admin).htblock, notblock).Hardening
TokenunblockModel::unblock(): it unblocked without confirmation and without the address check.<If>blocks in the block section are kept intact by every change and by the uninstallation. Before, any<If>line was taken for one of the plugin's own. A test checks that the copy of this logic inupdatescript.phpagrees withHtaccessHelper.dependencies.yml: composer runs in a job without write permissions. A separate job opens the issue, and only when a check found something, not on a network error.Clean-up
Settings::Defaults, read withSettings::get(),int(),bool()orstring(). Unknown names throw.SettingsDefaultsTestcompares the defaults with the form in both directions and fails on any inline default.LockHelper::file(),slot()anddirectory().Formshows, instead of posting a message on top of Joomla's own. The phpstan baseline entries for this pattern are replaced by one documentedignoreErrorsrule.edit403Message()andremove403Message(),DateRule,UnblockTokenRepository::exists(), the unused block-state helpers in the .htaccess list view, and the backend'sItemid.Origin::name()andIpHelper::prefixMask().plugin/deploy.shcopies every language, not just two.Requirements and CI
php_minimum, composer platform and lock, phpstanphpVersion, README, and the unit-test matrix (which now runs the unit tests on the minimum too).digestfield intests/ci/matrix.json, checked bycheck-joomla-checksums.php. PostgreSQL 15 replaces the end-of-life 12. MySQL 8.0 stays because it is Joomla 5.4's minimum.Testing
package/build.shbuilt.composer validate --strict.Translations for the three new language strings are included for all ten languages.
Generated by Claude Code