Act immediately on flagged signups Mastodon already auto-approved

account.approved never fires for a signup that went through open
registration without ever being queued (no prior block on that
address). process_signup was waiting on that event forever, so the
first flagged signup on any new bad IP/email domain never got welcomed
or watched by the suspicious-sweep. Now checks Admin::Account.approved
from the account.created payload and acts immediately if it's already
true.
This commit is contained in:
2026-07-06 13:27:15 -07:00
parent 0356fe7997
commit 51233868ca
2 changed files with 30 additions and 6 deletions
+11
View File
@@ -263,6 +263,17 @@ def ip_scrutiny_tests():
main.send_welcome("102", "dc1") # simulate account.approved's unconditional welcome
assert ("102", "dc1") in sent, sent
# B2. datacenter IP, held, but Mastodon already auto-approved the signup
# (open registration, never queued) -> account.approved will never
# fire, so process_signup must welcome + start the watch immediately
# instead of waiting for an event that isn't coming.
sent.clear(); dms.clear(); ipblocks.clear()
classifications["198.51.100.22"] = ("datacenter", "Example Cloud Hosting Inc", True)
main.process_signup("104", "dc3", "198.51.100.22", "", True)
assert ("104", "dc3") in sent, "already-approved flagged signup must be welcomed immediately"
assert main.get_signup_flag("104") is True
assert main.already_watched_suspicious("104"), "already-approved flagged signup must start its watch immediately"
# C. same datacenter IP, but IP_SCRUTINY_DRY_RUN -> welcomed immediately
# (no hold), no ip-block write, DM carries the dry-run prefix.
sent.clear(); dms.clear(); ipblocks.clear()