Repository navigation
Fix the open findings of issue #294 (3, 6, 7, 8, 10) - #334
Merged
Merged
Conversation
- 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
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.
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
handled = 1wouldn't work, becauseBlockService::block()marks the attempts handled before the mail is built.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 asfailedLogins. The plugin passes them on toblockedNotifyAdmin().NotifierHelper::mailsBlocks(): someone to mail, andnotifyBlockedNumber≠ 0), so a block without notifications costs no extra query. With notifications on, the query replaces the oldlistFromAddress()query.FailedLoginRepository::listFromAddress()is replaced bylistUnhandledFromAddress(): oldest first, capped at 100.6. IPv4-mapped IPv6 (
::ffff:203.0.113.5) is treated as IPv4IpHelper::unmapped(). It is applied ingetAddress()(toREMOTE_ADDRand the forwarding header),canonicalEntry(),lookupCandidates(),isInSubnet()andisTrustedProxy().::ffff:0:0/96become IPv4 networks (::ffff:203.0.113.0/120→203.0.113.0/24).canonicalEntry()(canonicalAddress()) does the same, so updates from before 2.0.0 convert existing list entries.InstallerScriptTestchecks 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.
riskMinBlockNumberaboveblockNumberSettingsModel::validate()refuses that combination. The error message is in all 10 component languages.BlockPolicy::effectiveBlockNumber()caps the floor atblockNumber, so a value stored some other way can't raise the threshold for everyone.8. The IP information page for blocked networks
GeoHelperlooks up a network by its network address instead of passing the CIDR string to the reader, which refused it.10. Removing
.htaccessentries needscore.admintooHtblocklistController::mayRemove():core.deleteandcore.admin, matchingHtblockController::mayAdd(). The toolbar uses the same check.Tests
IpHelperTest,IpHelperAddressTest,GeoHelperTest,BlockPolicyTest,ComponentTest,HtaccessHelperTest,InstallerScriptTest,RepositoriesTest,NotifierMailTest.main.🤖 Generated with Claude Code
https://claude.ai/code/session_01AFJFMNk79x7Vaix7rdiKER