Skip to content

Fix the open findings of issue #294 (3, 6, 7, 8, 10) - #334

Merged
codeling merged 1 commit into
mainfrom
ccr-a8afd56f-xotagn
Nov 21, 2026
Merged

codeling merged 1 commit into
mainfrom
ccr-a8afd56f-xotagn

Conversation

@codeling

@codeling codeling commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Closes #294: fixes items 3, 6, 7, 8 and 10. Item 1 moved to #335; 2, 4, 5 and 9 were already fixed on main.

Changes

3. The admin's "blocked" mail lists the attempts that caused the block

  • Before, the mail listed every failed login of the address within the block duration. For a permanent block that is 10 years, including attempts already handled by earlier blocks.
  • Simply filtering out handled = 1 wouldn't work, because BlockService::block() marks the attempts handled before the mail is built.
  • Instead, blockAsDecided() now reads the unhandled failed logins of the check interval (the ones the decision counted) under the block lock, before the block marks them handled, and returns them as failedLogins. The plugin passes them on to blockedNotifyAdmin().
  • They are read only if a mail can go out (NotifierHelper::mailsBlocks(): someone to mail, and notifyBlockedNumber ≠ 0), so a block without notifications costs no extra query. With notifications on, the query replaces the old listFromAddress() query.
  • FailedLoginRepository::listFromAddress() is replaced by listUnhandledFromAddress(): oldest first, capped at 100.
  • The mail text drops the "this list may hold more entries" notice in all 10 languages. It now says attempts behind earlier blocks are not listed.

6. IPv4-mapped IPv6 (::ffff:203.0.113.5) is treated as IPv4

  • New IpHelper::unmapped(). It is applied in getAddress() (to REMOTE_ADDR and the forwarding header), canonicalEntry(), lookupCandidates(), isInSubnet() and isTrustedProxy().
  • Networks inside ::ffff:0:0/96 become IPv4 networks (::ffff:203.0.113.0/120 → 203.0.113.0/24).
  • The update script's copy of canonicalEntry() (canonicalAddress()) does the same, so updates from before 2.0.0 convert existing list entries. InstallerScriptTest checks that the two copies agree.
  • HtaccessHelper::isEntryOf() matches an IPv4-mapped file entry to the IPv4 block, so entries that earlier versions wrote in that form are removed when the block ends.

7. riskMinBlockNumber above blockNumber

  • SettingsModel::validate() refuses that combination. The error message is in all 10 component languages.
  • BlockPolicy::effectiveBlockNumber() caps the floor at blockNumber, so a value stored some other way can't raise the threshold for everyone.

8. The IP information page for blocked networks

  • GeoHelper looks up a network by its network address instead of passing the CIDR string to the reader, which refused it.

10. Removing .htaccess entries needs core.admin too

  • New HtblocklistController::mayRemove(): core.delete and core.admin, matching HtblockController::mayAdd(). The toolbar uses the same check.

Tests

  • New or updated tests for each item: IpHelperTest, IpHelperAddressTest, GeoHelperTest, BlockPolicyTest, ComponentTest, HtaccessHelperTest, InstallerScriptTest, RepositoriesTest, NotifierMailTest.
  • Run locally:
    • Unit suite: 289 tests pass.
    • Integration suite on Joomla 5.4.10 with PostgreSQL 16: 443 tests pass. 5 were skipped for environment reasons (php-cgi not installed, running as root, MySQL-only tests).
    • Language lint: no errors or warnings.
    • phpstan: no new findings compared with main.
  • Not run locally: MySQL/MariaDB and Joomla 6. CI covers those.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AFJFMNk79x7Vaix7rdiKER

- 3: the administrators' mail about a block lists the failed logins
  which led to it - the unhandled ones of the check interval, read under
  the block's lock before the block marks them handled, and only if a
  mail may be sent - instead of every failed login of the address in the
  block's duration (ten years for a permanent block, including the
  attempts of earlier blocks). The mail no longer says it may list more.
- 6: an IPv4 client which the web server reports as IPv4-mapped IPv6
  (::ffff:203.0.113.5) is the IPv4 address: IpHelper::unmapped() in
  getAddress() (REMOTE_ADDR and the forwarding header), canonicalEntry(),
  lookupCandidates(), isInSubnet() and isTrustedProxy(). The update's
  copy of canonicalEntry() converts the lists' entries alike, and the
  .htaccess entries earlier versions wrote in that form are taken out
  with the IPv4 block.
- 7: riskMinBlockNumber above blockNumber no longer raises the threshold
  of every client: the settings page refuses it, and
  BlockPolicy::effectiveBlockNumber() caps the floor at blockNumber.
- 8: the IP information page looks a network (an IPv6 client's /56 of
  the block list) up by its network address, instead of handing the CIDR
  to the GeoIP reader, which refused it.
- 10: taking entries out of the .htaccess file needs core.admin as well
  as core.delete, as adding one does (HtblocklistController::mayRemove(),
  which the toolbar asks too).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFJFMNk79x7Vaix7rdiKER
@codeling
codeling merged commit c94599a into main Nov 21, 2026
20 checks passed
@codeling
codeling deleted the ccr-a8afd56f-xotagn branch November 21, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remaining review findings in plugin and component: row limits, mails, address matching, smaller bugs

2 participants