Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

check_username_for_spam's documentation incorrectly claims that avatar_url and display_name are never None #12245

Closed
squahtx opened this issue Mar 17, 2022 · 1 comment · Fixed by #12246
Assignees
Labels
T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@squahtx
Copy link
Contributor

squahtx commented Mar 17, 2022

Description

The Synapse documentation claims that the check_username_for_spam spam checker callback receives a userprofile that is a Dict[str, str]. In practice, there can be Nones in the userprofile dict, eg.

{
    avatar_url: None, 
    display_name: None, 
    user_id: '@[redacted]:matrix.org'
}

See https://sentry.matrix.org/sentry/synapse-matrixorg/issues/243697/ for examples of userprofiles with missing avatars and display names.

docs/modules/spam_checker_callbacks.md and CHECK_USERNAME_FOR_SPAM_CALLBACK could do with an update.

@squahtx squahtx added the T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. label Mar 17, 2022
@DMRobertson
Copy link
Contributor

We didn't detect this because the function which fetches the data from the db is annotated to return JsonDict.

I would really like a systematic approach to catch this kind of thing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants