feat(matrixbot): remove the auto-invite welcome flow entirely
Lint / JS (eslint) (push) Successful in 1m16s
Lint / Python (ruff) (push) Successful in 6s
Lint / Python deps (pip-audit) (push) Successful in 1m1s
Lint / Secret scan (gitleaks) (push) Successful in 7s
Lint / Shell (shellcheck) (push) Successful in 16s

Joining the Lotus Guild Space (join_rule: public) triggered a welcome DM;
reacting to it made the bot invite that user into a fixed room list. Now
that #general is published to the public room directory, any stranger can
join the Space and trigger this.

The room list excluded the invite-only rooms, but it included Voice, whose
join rule is `knock`. An invite bypasses a knock gate, so a stranger could
skip the approval step that rule exists to enforce.

Removes welcome.py, the Space-join watcher in Callbacks.member, both
welcome-reaction hooks, and the admin `cleanwelcome` command. The bot no
longer issues invites automatically anywhere. The PL50+ `invite` and
`inviteall` commands are untouched: those are deliberate admin actions.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-16 15:46:36 -04:00
co-authored by Claude Opus 5
parent 9e5d3ec83d
commit fb933b0b13
4 changed files with 9 additions and 212 deletions
+8 -26
View File
@@ -14,8 +14,6 @@ from commands import (
record_nhie_reaction,
record_hottake_reaction,
)
from welcome import handle_welcome_reaction, handle_space_join, SPACE_ROOM_ID
logger = logging.getLogger("matrixbot")
@@ -95,7 +93,6 @@ class Callbacks:
key = event.key
logger.info("reaction: key=%r target=%s sender=%s", key, reacted_event_id[:16], event.sender)
await handle_welcome_reaction(self.client, room.room_id, event.sender, reacted_event_id, key)
record_wyr_vote(reacted_event_id, event.sender, key)
record_acronym_vote(reacted_event_id, event.sender, key)
record_nhie_reaction(reacted_event_id, event.sender, key)
@@ -119,33 +116,18 @@ class Callbacks:
key = relates_to.get("key", "")
logger.info("unknown_event reaction: key=%r target=%s sender=%s", key, reacted_event_id[:16], event.sender)
await handle_welcome_reaction(self.client, room.room_id, event.sender, reacted_event_id, key)
record_wyr_vote(reacted_event_id, event.sender, key)
record_acronym_vote(reacted_event_id, event.sender, key)
record_nhie_reaction(reacted_event_id, event.sender, key)
record_hottake_reaction(reacted_event_id, event.sender, key)
async def member(self, room, event):
"""Handle m.room.member events — watch for Space joins."""
# Ignore events from before startup
if self.startup_sync_token is None:
return
"""Handle m.room.member events.
# Only care about the Space
if room.room_id != SPACE_ROOM_ID:
return
# Ignore our own membership changes
if event.state_key == MATRIX_USER_ID:
return
# Only trigger on joins (not leaves, bans, etc.)
if event.membership != "join":
return
# Check if this is a new join (prev was not "join")
prev = event.prev_membership if hasattr(event, "prev_membership") else None
if prev == "join":
return # Already was a member, this is a profile update or similar
await handle_space_join(self.client, event.state_key)
The Space-join welcome flow was removed deliberately: it DM'd anyone
who joined the (public) Space and, on a reaction, invited them into
rooms including Voice, whose join rule is `knock`. An invite bypasses
that gate, so a stranger could skip the approval step entirely. The
bot no longer issues invites of any kind.
"""
return