Repository navigation
Description
This came out of a review of the plugin and component at 2501aca / cfe9835. The findings that needed a fix are in the stacked PRs:
| PR | Finding |
|---|---|
| #275 | .htaccess section only denies (it granted access before), migration, Apache CI job, CRLF |
| #276 + codeling/com_bfstop#41 | no request-derived URLs in mails without $live_site |
| #277 + codeling/com_bfstop#42 | no .htaccess block of networks that overlap the allow list |
| #278 | one block per burst of parallel failed logins |
| #279 | login attempts refused while the block list can't be read |
| #280 + codeling/com_bfstop#43 | unblock page: form token, no unblock without the block's address |
| #281 + codeling/com_bfstop#44 | core.admin for .htaccess and wide blocks; safehtml blocked message |
| #282 + codeling/com_bfstop#45 | notification addresses validated; proxy setting validated |
These are the remaining proposals: defence in depth, and design gaps that are not bugs. Roughly ordered by value for the effort.
1. Make fail-open visible
#279 makes login attempts fail closed when the block list can't be read; everything else still fails open, intentionally. Nobody notices when that happens, though. The log is only visible to core.admin, and only at the default ERROR level.
- Count DB failures per day, in a small state table (see A3 in the architecture issue), and show a warning on the component's pages ("BFStop could not read its tables N times in the last 24 h").
- Optionally include them in the admin mail.
insertFailedLogin()failing means the attempt is not counted. That should be counted as a failure too.
2. Audit trail through User Actions Log
Blocks, unblocks (backend and token), allow-list changes, settings changes and clearing the log should go to Joomla's User Actions Log (ActionlogModel::addLog(), or an actionlog plugin). BFStop's own log can be cleared by the very people it should hold to account, and it is only kept for 28 days by default.
3. Login-only mode: covered endpoints (finding S7)
isLoginAttemptRequest() only recognises com_users …login and com_login …login (and API requests with credentials). A blocked client can still log in, in this mode, through:
com_ajax(core WebAuthn passkeys, harmless for brute force);- third-party social/SSO login components;
- login modules that post to their own controllers.
Options:
- document what is covered, and recommend
fullmode when third-party logins are installed; - deny in
onUserAuthorisation(returnSTATUS_DENIED) for blocked addresses as a backstop. Caveat: Joomla then showsJLIB_LOGIN_DENIEDonly after a correct password, which is a password oracle. Only do this if the message can be made the same as for a wrong password (e.g. throughonUserAuthorisationFailureand replacing the message queue).
4. Recovery endpoints while blocked (finding S8)
Keeping password reset and username reminder reachable for blocked clients is deliberate and right. Joomla limits reset.request per user (reset_count/reset_time), but remind.remind has no limit and the captcha is optional.
- While an address is blocked, allow at most N recovery POSTs per hour from it (store them as
failedloginrows with a separate origin, or in a counter table). - Recommend enabling the captcha for com_users reset/remind on the settings page.
5. Proxy configuration
#282 validates the trusted-proxy list. Still open:
- Rate-limit the warning "the request did not originate from the configured proxy" (
IpHelper::getAddress()). Every direct request writes one, so an attacker can push real entries out of the rotated log. Once per address per hour is enough. - The settings page should say that the single-valued headers (
Client-Ip,X-Cluster-Client-Ip) are only safe if the proxy overwrites them; they can't be read "from the right". - A self-test on the settings page: "this request came from X, via Y; the address used is Z".
6. Response headers on the blocked page and the unblock page
Add X-Content-Type-Options: nosniff and Content-Security-Policy: frame-ancestors 'none' (or X-Frame-Options: DENY). The blocked page is echoed raw, without the template; the unblock page goes through the template.
7. Web-server backend
- Detect LiteSpeed (partial
<If>support) and nginx, and refuse.htaccessmode there with a clear message instead of only the generic "htaccess not working" warning. - Optionally offer an nginx include file (
deny <addr>;) written to a configured path, for sites behind nginx. - Optionally check on the settings page that the
.htaccessis actually effective (e.g. request a test URL with a header the section denies). The// TODO: add check whether .htaccess actually is effective!inDisplayController::warnIfHtAccessNotWorking()is still open.
8. Request cost (DoS)
See A4 in the architecture issue: create the notifier lazily, cache the address for the request, make username lookups index-friendly, and set a query budget per failed login enforced by a test. Blocked clients currently cost a full Joomla boot plus 2–3 queries per request; for full mode, consider answering them already in onAfterInitialise when no exemption can apply (non-site clients, no com_users/com_bfstop request).
9. Updates and supply chain
CI is already in good shape: actions pinned to SHAs, SHA-256 checks of Joomla and the previous release, least-privilege permissions:, draft releases. Still open:
- The update details file at
detailsurl(update-pkg.xml) is hosted outside the repositories (and planned for GitHub Pages in Release plan for 2.0.0 #250). Make sure the generator writes a<sha512>(or<sha384>) for each package, which Joomla checks before installing. - Consider GitHub artifact attestations (
actions/attest-build-provenance) for the release zips.
10. Tests
- A query-count test (item 8).
- phpstan in CI (see the code-smell issue).
- An end-to-end mail test against a local SMTP sink (e.g.
mailpitin CI) that checks that no mail contains a request-derived host (Security: no addresses from the request in mails without $live_site #276) and that exactly one block mail is sent per burst (Block a client once when parallel failed logins reach the threshold #278).
Activity
codeling commentedon Nov 21, 2026
Status of each item:
FailurePolicy, is logged at error level and counted per request (64389c6, #284 A6). A failedinsertFailedLogin()is included. Open: a daily count kept beyond the request, the warning on the component's pages, and the admin mail.onUserAuthorisationbackstop, because of the password-oracle caveat.Client-Ip/X-Cluster-Client-Ipis added, and there's a self-test on the settings page (#336).nosniffon the blocked page (16ce370).frame-ancestors 'none'andX-Frame-Options: DENYon the blocked page;X-Frame-Options: DENYandnosniffon the unblock page (#336)..htaccessmode is refused on nginx, and LiteSpeed gets its own warning (#336). Open: the nginx include file, and the check that the.htaccessfile actually works (the TODO inDisplayController).onAfterInitialiseinfullmode.update-pkg.xmlgets a<sha256>per package (ee04429). Build provenance attestations for the release zips (#336).Generated by Claude Code
Refuse blocked backend and API requests before routing (issue #285, i…
Limit the password recovery submissions of a blocked address (issue #285
Record administrators' actions in Joomla's User Actions Log (issue #285…
Check from the settings page whether the .htaccess block section work…
Optional nginx deny file for sites behind nginx (issue #285, item 7)
codeling commentedon Nov 21, 2026
Update: every item is now done in #336 (one commit per item) or moved to an issue of its own.
onUserAuthorisationbackstop is moved to #338.htaccessself-check (752167f), the nginx deny file (59daccb)#336 says "Closes #285", so this issue closes when it's merged.
Generated by Claude Code
Merge pull request #336 (hardening proposals)