Page MenuHomePhabricator

Allow creating custom Echo notifications
Open, MediumPublicFeature

Assigned To
Authored By
Legoktm
Oct 30 2013, 5:39 AM
Referenced Files
F54944922: Screenshot from 2024-06-04 18-18-22.png
Jun 4 2024, 10:31 PM
F54944918: Screenshot from 2024-06-04 18-17-15.png
Jun 4 2024, 10:31 PM
F51562876: Screenshot from 2024-05-09 19-11-58.png
May 9 2024, 11:13 PM
Tokens
"Fox" token, awarded by Soda."Love" token, awarded by Ladsgroup."100" token, awarded by Framawiki."Barnstar" token, awarded by Enterprisey."Like" token, awarded by jhsoby."Love" token, awarded by xcombelle."Love" token, awarded by Luke081515."Like" token, awarded by Sylvain_WMFr."Love" token, awarded by Sadads."Love" token, awarded by Trizek-WMF."Love" token, awarded by MGChecker.

Description

Background

Communities can employ a variety of means to send out notifications, such as watchlist notices and geonotices, site notices, or for cross-wiki, CentralNotice. These are effective but can be a bit too in-your-face, or in the case of watchlist/geonotices, only viewable by people who use their watchlist. They also don't allow you target specific users. For more targeted messaging at scale, there's MassMessage, but this uses a talk page notice which is publicly viewable.

If we were able to send custom notifications, that'd allow us to leverage the advantages Echo provides -- that is, notifying specific users in a way that is not vexatious but still attention-grabbing, and can also be viewed cross-wiki.

Use-cases

The use-cases are wide, but largely around users "subscribing" to be notified with a specific message after something specific occurs.

Current state

Patch Demo: https://patchdemo.wmflabs.org/wikis/38e6b4ea7b/wiki/Special:ApiSandbox (use username Patch Demo, password patchdemo1)

As of June 2024, we have a new action=echocreateevent API that allows sending custom notifications -- including the title and message body. This is behind the $wgEchoEnableApiEvents feature flag which is not enabled on any wikis yet.

You can test out the using Special:ApiSandbox:

  • Got to Special:ApiSandbox
  • Select "echocreateevent" from the "action" dropdown
  • On the left, click on "action=echocreateevent"
  • Fill in the form as desired
  • Auto-fill the token and "Make request"

Screenshot from 2024-06-04 18-17-15.png (1×980 px, 108 KB)
Screenshot from 2024-06-04 18-18-22.png (257×664 px, 28 KB)

Abuse potential

This feature has the potential to be abused, i.e. "YOUR ACCOUNT HAS BEEN HACKED, GO TO [this link] TO RESET YOURPASSWORD".

For abuse mitigation, we can explore:

  • Using the bot icon instead of something used by system notifications (already done)
  • Introducing a new, dedicated user group that has the echo-create permission. Communities should be instructed that only highly trusted users (or more commonly, bots) should belong to this group.
  • Logging all notifications sent (r958058)
  • Possibly requiring the API accept a page title that defines the message, so that the message can be audited.
    • Not ideal for "remind me bot" use-case as the bot would have to create a new page for every message, or re-use the same one (clunky).
    • This would mean no private messages could be sent. (i.e. for admins who want to be notified about something without beans up their nose)
  • Enforce a consistent title or message body for all API-issued notifications
    • Something like "This is a bot-issued notification sent by User:Foo"
    • The message title can be long and will wrap, but the message body doesn't. For this reason, it may be better to restrict only the message body and not the title (?)
    • Maybe the linked "Page" can serve the notification. In the case of Remind Me Bot, the user hopefully will remember why they wanted to be reminded about said article. For custom messages, it links to a page containing said message.
Other concerns

Other ideas

  • Add a Special page allowing admins (or users of the new user group) to issue one-off notifications, perhaps only being able to choose from a preselected list of types of notifications

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

A use-case form non-wikimedia wikis would be: being able to create notification types to be triggered when pages are created having certain criteria; such as a specific category or in a specific namespace.

For example in our organisation we use mediawiki for our documentation and have a namespace for minutes of meetings. We'd like all users to be notified when a new page in the MoMs namespace is created.

We'd like the wiki administrator to be able to create such a notification, and turn it on by default for all users, with email notification also enabled.

Similar to what's described in https://mediawiki.org/wiki/Extension:Email_notification/to-do#new-page_notification

@ahmad Thanks for the use-case description.
Just fyi, that page you linked is unrelated to this feature (the more recent Echo/Notifications system is currently distinct from the ancient "enotif" (email notification) system). Also fyi, the current list of requested new notification-types for Echo is at T125653: Create new types of notifications (of which this is a subtask) and semi-duplicated onwiki at https://www.mediawiki.org/wiki/Notifications#Suggested_new_notification_types

Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 12:23 PM
Aklapper removed a subscriber: wikibugs-l-list.

Change 928980 had a related patch set uploaded (by SD0001; author: SD0001):

[mediawiki/extensions/Echo@master] Add API module for sending notifications

https://gerrit.wikimedia.org/r/928980

Have raised a patch which adds an API for bots to deliver notifications to users. There is no UI - and probably there doesn't need to be as this doesn't seem like something that makes much sense in a non-automated context. Per T306211, it also allows sending notifications to self (even if you're not a bot), which could be used in gadgets or OAuth based tools.

Things to consider:

  • Should this be a logged action? If so, what all details should be logged?
  • Should users be able to mute notifications from specific bots?
    • Since the same bot could send multiple kinds of notifications, should there be an alternative mute mechanism?
  • What should be the size limits on the header and body contents of these notifications?
  • Could this be used by a bot operator to harass someone, knowing that contents of notifications aren't logged?

IMO:

  • Public logging should only include the bot sending the notification and the user receiving it. Private logging can include all details of the notification, but be restricted to crats / stewards.
  • Bots should be able to define categories of notifications that they send through an API. Users should then be able to granularly mute notifications in each category.
  • Size limit should be the same as other types of notifications, for standardization.
  • This definitely is a concerning possibility. I think that logging of the entire notification's contents, available to crats + stewards, could help mitigate this.

I also think that it'd be nice to be able to send notifications from one user to another. One use case of this would be sending small, private notes, without needing email. I also think that having a UI, even if it will be a bots-only feature, will be helpful, especially for debugging.

Coming back to this, I'm not sure if logging is a good idea. The closest MW function to this is email which is also not logged (except for the private CheckUser logging which identifies just the sender). Regarding the harassment possibility, I think we can ignore the concern as the same holds for email as well (to a bigger extent - emails don't have size limits and are available to all users than just bots, and even blocked users can send emails!).

Also, Echo allows the same EchoEvent to result in notifications to multiple users – if we want to expand the API to allow multiple recipients (which has reasonable usecases - such as notifying all major contributors of an article which is AfD'd), it will be cumbersome to log all the recipients in one log entry.

I thought that email contents were available to sysadmins?

Question. Could an editor apply for the notifications of a certain article "from the bot"? It could work like watchlist for notifications. It'd be useful for all the notifications that reach article creators that are not anymore active or have another account. Also if a wikilink is added from one to an other page, then both articles might be able to be expanded. Maybe it is also a wrong wikilink, which then can be removed. Notifications of AfDs for articles where its creator is not active anymore or has been blocked. And we all one day will leave wikipedia, and then the notifications from "our" articles will reach no-one. It like to think of a democratization or demonopolization of notifications :)

Change 958058 had a related patch set uploaded (by SD0001; author: SD0001):

[mediawiki/extensions/Echo@master] Add logging for notifications sent via API module

https://gerrit.wikimedia.org/r/958058

Change 958058 abandoned by SD0001:

[mediawiki/extensions/Echo@master] Add logging for notifications sent via API module

Reason:

no need for logging

https://gerrit.wikimedia.org/r/958058

Change #928980 merged by jenkins-bot:

[mediawiki/extensions/Echo@master] Add API module for sending notifications

https://gerrit.wikimedia.org/r/928980

Some remaining to-dos before rolling this out:

For the curious, here's an example notification with what we have now:

Screenshot from 2024-05-09 19-11-58.png (145×643 px, 13 KB)

I'm concerned about the potential for abuse that exists with this feature:

  • sending abusive messages to individuals
  • phishing
  • spam

One thought would be to define the list of available subject/content messages via Community Configuration on a per-wiki basis. So if you want to define an arbitrary message for an Echo notice, you need to get it added to your wiki via Community Configuration (which has an auditable list of changes) and then the API module can only choose from the predefined list.

Before this is enabled in production, it would be nice to see potential abuse vectors identified along with mitigations.

Would we enable notifying others in production?

Would we enable notifying others in production?

https://gerrit.wikimedia.org/r/928980 allows for sending notification to other users.

  • sending abusive messages to individuals
  • phishing
  • spam

Just like mass-message sending, these require a permission (echo-create). Since the former hasn't devolved into such chaos, I think we're safe here, and making it just a permission would allow for far more fluidity than a configuration.

  • sending abusive messages to individuals
  • phishing
  • spam

Just like mass-message sending, these require a permission (echo-create). Since the former hasn't devolved into such chaos, I think we're safe here, and making it just a permission would allow for far more fluidity than a configuration.

I think some important differences are:

  • MassMessage sends are logged and auditable
  • MassMessages are generated from wiki pages, which again can be audited and inspected

The feature introduced in the patch for this task allows for sending arbitrary notification contents to other users without the ability to audit who is sending, who is receiving, or what the contents of the messages are.

That does seem like a problem. So maybe another QA would be logs.

All great points! Also raising the comment from Security (@sbassett):

From a security perspective, I don't think this should be default-enabled for bot accounts. I don't really think it matters what the approval process might look like, but some process should exist. I think the Security Team would rate this at least a medium risk, which would require WMF director-level risk acceptance.

Sounds like we should create a new user group, then? The communities can decide for themselves the process.

Having the permission in some default user group I think would be ideal, however. What if it were assigned only to sysop by default, and on our cluster we can add a new dedicated user group?

The feature introduced in the patch for this task allows for sending arbitrary notification contents to other users without the ability to audit who is sending, who is receiving, or what the contents of the messages are.

I agree adding logging is a good idea. r958058 was abandoned, see T58362#8959582. Those are good reasons to not log in my opinion, but perhaps they do not outweigh the concerns of abuse.

From a product perspective, I'm not sure we'd necessarily want the contents of the message logged. The primary use-case in my view is for things like T2582 and T189391 (i.e. "remind me bot"), which is a long-desired feature. For this purpose, users may not want a lot of the reminders being public (either for personal reasons, or WP:BEANS, etc.). Of course, for the immediate future, you'd have to either code up your own bot or submit your "private" reminder through some tool, so it wouldn't be truly private per-se.

Another idea is to simply ignore that "private" use case and require the content live on-wiki, making ApiEchoCreateEvent accept only a page title for both the notification header and content. How does that sound?

Also keep in mind this primary use-case is "remind me", not a list of people you're trying to spam. Issuing an echo notification to yourself is harmless. Perhaps we could adjust the config settings so that we could deploy self-issued notifications while we figure out abuse mitigations for notifying others. The problem there is this means the user either has to grant some long-term OAuth access to a tool, or rely on a clientside implementation which might require running a bit of JS on every page load to check against the wall clock.

All great points! Also raising the comment from Security (@sbassett):

From a security perspective, I don't think this should be default-enabled for bot accounts. I don't really think it matters what the approval process might look like, but some process should exist. I think the Security Team would rate this at least a medium risk, which would require WMF director-level risk acceptance.

Sounds like we should create a new user group, then? The communities can decide for themselves the process.

Having the permission in some default user group I think would be ideal, however. What if it were assigned only to sysop by default, and on our cluster we can add a new dedicated user group?

@sbassett what do you think about this?

The feature introduced in the patch for this task allows for sending arbitrary notification contents to other users without the ability to audit who is sending, who is receiving, or what the contents of the messages are.

I agree adding logging is a good idea. r958058 was abandoned, see T58362#8959582. Those are good reasons to not log in my opinion, but perhaps they do not outweigh the concerns of abuse.

I think those are reasonable arguments, but IMO the lack of sufficient safeguards around abusing email functionality for harassment doesn't justify introducing another vector for abuse.

From a product perspective, I'm not sure we'd necessarily want the contents of the message logged. The primary use-case in my view is for things like T2582 and T189391 (i.e. "remind me bot"), which is a long-desired feature. For this purpose, users may not want a lot of the reminders being public (either for personal reasons, or WP:BEANS, etc.). Of course, for the immediate future, you'd have to either code up your own bot or submit your "private" reminder through some tool, so it wouldn't be truly private per-se.

Then should we adjust this feature to only allow sending notifications to your own account? That is less concerning from an abuse perspective.

Another idea is to simply ignore that "private" use case and require the content live on-wiki, making ApiEchoCreateEvent accept only a page title for both the notification header and content. How does that sound?

That sounds like a good idea to me, so there is some level of auditablity.

Also keep in mind this primary use-case is "remind me", not a list of people you're trying to spam. Issuing an echo notification to yourself is harmless.

Sort of. Each notification invokes a lot of code paths and results in rows being added to append-only storage. So we can't e.g. allow all accounts to generate some large number of these notifications without also consulting DBAs T308084: Reduce DB space used by Echo notifications.

Would we enable notifying others in production?

https://gerrit.wikimedia.org/r/928980 allows for sending notification to other users.

Not really. The feature is restricted to bots – which are supposed to only do actions approved via the BRFA process; any unapproved actions are grounds for a WP:BOTBLOCK, whether constructive or not. Bot flag on any kind of wiki indicates some level of trust. If we were to allow normal users to send notifications, I would also be very worried. Remember that bots are already entrusted with the extremely dangerous noratelimit right which is literally a DOS vector.

But as Security has issues with assigning the right to the default bot group, we can certainly create a new group, say "Notification bot" (along the lines of "Copyright violation bot"). Per the principle of least privileges, it makes sense not to give the right to all bots that don't have a need for it.

I am open to adding logging, but I think we should only log the sender and receiver, and maybe the header. Logging the content kills the point - the bot might as well just send a talk page message. Instead, I suggest we provide a "Report spam" button – which creates a new log entry which does publicly record the full contents of the notification. This would allow reviewing reports of abuse.

Change #1036300 had a related patch set uploaded (by SD0001; author: SD0001):

[mediawiki/extensions/Echo@master] Don't assign echo-create right to bots by default

https://gerrit.wikimedia.org/r/1036300

Change #958058 restored by SD0001:

[mediawiki/extensions/Echo@master] Add logging for notifications sent via API module

https://gerrit.wikimedia.org/r/958058

Change #1036300 merged by jenkins-bot:

[mediawiki/extensions/Echo@master] Don't assign echo-create right to bots by default

https://gerrit.wikimedia.org/r/1036300

@SD0001 thanks for picking up this task to support custom notifications!

I'm the Product Manager of the Growth team at the Wikimedia Foundation, and since the Growth team is currently responsible for maintaining Echo, I wanted to get up to speed on this task.

I am interested in learning more about the progress of this task. However, it's difficult to gauge the current state of the work without reviewing the patches. Could you please update the task description with the current implementation plan? Including a few screenshots would be incredibly helpful. Maybe a few subscribers could also add more use-case examples of how they want to use this feature?

I understand that you have already been considering this, but I just want to be sure we aren't introducing trust & privacy issues. And as Echo notifications can trigger emails, I'm also thinking about navigating international email compliance laws.

Thank you once again for your hard work on this task! My comment is not meant to derail this effort, but I do think it might be good to pause so I have a chance to make sure WMF product, legal, and security teams can review and consider the implications of this task. I apologize for providing this feedback at this stage in your work. Normally, I would conduct this type of review for my team before they start engineering work on a task like this. However, I want to make sure an important change like this receives the necessary review and attention.

Change #1038916 had a related patch set uploaded (by MusikAnimal; author: MusikAnimal):

[mediawiki/extensions/Echo@master] [DO NOT MERGE] enable EchoEnableApiEvents and give sysop permission

https://gerrit.wikimedia.org/r/1038916

MusikAnimal renamed this task from Allow users to create custom notifications onwiki to Allow creating custom Echo notifications.Jun 4 2024, 10:31 PM
MusikAnimal updated the task description. (Show Details)

Could you please update the task description with the current implementation plan? Including a few screenshots would be incredibly helpful. Maybe a few subscribers could also add more use-case examples of how they want to use this feature?

I took a stab at it, also re-titling to reflect what this task has evolved into. The original title was only about issuing notifications through some on-wiki means (not just the API), but the scope has since expanded. I think the Special page idea is still good though, so it's mentioned under "Other ideas".

@SD0001 (and anyone) please adjust or correct the description as you see fit!

Maybe one db performance request: Make sure it wouldn't send notification to bots. That's the source of much of headache on the database level. We have decent storage in x1, I don't think it should block the deployment from DBA perspective, but please prioritize T308084: Reduce DB space used by Echo notifications (OTOH, you have to try really hard to make as much as mess the current page link notification, it sends around 100M notification every year to bots)