Skip to content

feat: add optional StopForumSpam registration screening - #2238

Open
melroy89 wants to merge 4 commits into
mainfrom
feat/stopforumspam-registration
Open

melroy89 wants to merge 4 commits into
mainfrom
feat/stopforumspam-registration

Conversation

@melroy89

@melroy89 melroy89 commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Add optional StopForumSpam IP screening (free service) to password and SSO registrations. Lookups and automatic rejection are disabled by default and configurable in /admin/settings. Automatic rejection requires a database match and both confidence and frequency thresholds (defaults: 95% and 5), before any account or signup messages are created.

Pending applications show the registration-time screening result on the approval page and send an approval-request email to admins who enable signup notifications. The private snapshot is erased on approval, rejection, or deletion; existing in-app notifications are preserved.

Rationale

I got sick of all the spam users and bot registrations on my server.

Additional information

This PR targets upgrade_dependencies and depends on #2162, keeping the feature diff separate from the dependency upgrade.

  • Resolve signup IPs through Symfony's trusted-proxy handling, including GitHub signup. Existing logins, account linking, operator-created accounts, and federation are excluded.
  • Use HTTPS POST, a three-second deadline, no retries, short-lived cached results, and a shared outbound quota. Failed or unavailable checks continue under the existing approval policy.
  • Keep both threshold inputs consistent with Mbin's existing input styling, with server-side numeric validation.
  • Include the nullable JSONB snapshot migration and administrator setup/privacy documentation. Apply the migration and restart Messenger workers during deployment.

Validation

  • 27 focused unit tests passed (73 assertions), covering parsing, thresholds, cache reuse, timeout/quota failures, email eligibility, snapshot privacy, and defaults.
  • 24 focused functional tests passed (269 assertions), covering registration, settings/API validation, approval email recipients/content, snapshot cleanup, trusted/spoofed headers, and rate limiting.
  • Migration down/up passed against an isolated PostgreSQL test database; the new user mapping validated.
  • Container, Twig, YAML, PHP style, and whitespace checks passed. PHPStan passed for the two new services.
  • Chrome verified settings save/persistence, approval-page rendering, and matching input dimensions at desktop and 390px mobile widths, with no new-section overflow.

Stored screening snapshot

registration_screening is a nullable JSONB snapshot retained only for pending applications when screening is enabled. Approval, rejection, or deletion clears it to NULL; automatic rejection creates no user record. It is excluded from user API serialization.

Illustrative example:

{
  "ip": "192.0.2.10",
  "status": "matched",
  "frequency": 12,
  "confidence": 97.5,
  "lastseen": "2026-10-05 10:00:00",
  "checked_at": "2026-10-05T12:00:00+00:00",
  "cached": false,
  "failure": null
}

status is matched, no_match, or unavailable. Unavailable checks have null result fields and a failure reason such as request_failed or quota_exhausted.

Screenshots

Captured from the isolated test instance. The approval example uses a fictional account, reserved example IP, and illustrative screening data.

Desktop settings

Desktop settings

Mobile settings

Mobile settings

Signup approval

Signup approval

@melroy89 melroy89 added the enhancement New feature or request label Oct 5, 2026
Comment thread config/packages/rate_limiter.yaml
Base automatically changed from upgrade_dependencies to main October 6, 2026 23:15
@melroy89

melroy89 commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

ok rebased to latest main now.

@melroy89
melroy89 force-pushed the feat/stopforumspam-registration branch from 2f80933 to 88ac92c Compare October 8, 2026 19:43
@melroy89
melroy89 requested review from BentiGorlich and blued-gear and removed request for blued-gear October 9, 2026 18:29
@melroy89 melroy89 added the backend Backend related issues and pull requests label Oct 9, 2026
@melroy89
melroy89 force-pushed the feat/stopforumspam-registration branch from 9070331 to 4ad8211 Compare October 13, 2026 14:04
@melroy89

Copy link
Copy Markdown
Member Author

Rebased

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend related issues and pull requests enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant