Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Allow spam checker to reject invites too #2492

Merged
merged 9 commits into from Oct 3, 2017

Conversation

Projects
None yet
2 participants
Member

dbkr commented Oct 3, 2017

No description provided.

synapse/handlers/room_member.py
+ block_invite = True
+
+ if not self.spam_checker.user_may_invite(requester.user):
+ block_invite = True
@erikjohnston

erikjohnston Oct 3, 2017

Owner

Do we want this to apply to server admins?

@dbkr

dbkr Oct 3, 2017

Member

hmm, I guess not actually

dbkr added some commits Oct 3, 2017

Federation was passing strings anyway
so pass string everywhere
synapse/events/spamcheck.py
@@ -45,3 +45,19 @@ def check_event_for_spam(self, event):
return False
return self.spam_checker.check_event_for_spam(event)
+
+ def user_may_invite(self, userid):
@erikjohnston

erikjohnston Oct 3, 2017

Owner

I wonder if we also want to include the room_id here, so that you can fonx all invites for known bad rooms (or whitelist known good rooms)

@dbkr

dbkr Oct 3, 2017

Member

mm, could be useful

synapse/events/spamcheck.py
@@ -45,3 +45,19 @@ def check_event_for_spam(self, event):
return False
return self.spam_checker.check_event_for_spam(event)
+
+ def user_may_invite(self, userid, roomid):
@erikjohnston

erikjohnston Oct 3, 2017

Owner

Normally we call it room_id

@dbkr dbkr merged commit 5f20a91 into develop Oct 3, 2017

6 of 8 checks passed

Sytest Dendron (Commit) Build #2696 origin/dbkr/spam_check_invites failed in 1 min 32 sec
Details
Sytest Dendron (Merged PR) Build finished.
Details
Sytest Postgres (Commit) Build #3530 origin/dbkr/spam_check_invites succeeded in 3 min 50 sec
Details
Sytest Postgres (Merged PR) Build finished.
Details
Sytest SQLite (Commit) Build #3624 origin/dbkr/spam_check_invites succeeded in 1 min 46 sec
Details
Sytest SQLite (Merged PR) Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@dbkr dbkr deleted the dbkr/spam_check_invites branch Oct 17, 2017

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