Page MenuHomePhabricator

[keyserver] Handle offensive words in invite links
ClosedPublic

Authored by tomek on Jul 18 2023, 4:14 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jul 5, 6:54 PM
Unknown Object (File)
Fri, Jul 5, 6:54 PM
Unknown Object (File)
Fri, Jul 5, 9:49 AM
Unknown Object (File)
Thu, Jul 4, 12:09 PM
Unknown Object (File)
Wed, Jul 3, 7:38 PM
Unknown Object (File)
Wed, Jun 12, 6:18 AM
Unknown Object (File)
Mon, Jun 10, 7:24 PM
Unknown Object (File)
Jun 5 2024, 6:08 PM
Subscribers
None

Details

Summary

Check if an invite link contains abusive words and return an error if that's the case.

https://linear.app/comm/issue/ENG-4181/handle-offensive-abusive-words
https://www.npmjs.com/package/bad-words

Depends on D8494

Test Plan

Tried to create a link consisting of just an offensive word and an error was returned.
Tried to create a link with a string consisting of an offensive word with some prefix - a link was created correctly. This isn't ideal, but handing it correctly might be challenging: e.g. invite/class sounds like a proper link, but simply checking if it contains an offensive substring would forbid it.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tomek requested review of this revision.Jul 18 2023, 4:32 AM

Can you provide some more context on the selection of this package? I noticed it hasn't been updated in 3 years and has some unaddressed GitHub issues, but I'm guessing your research showed that it's the best option.

Can you provide some more context on the selection of this package? I noticed it hasn't been updated in 3 years and has some unaddressed GitHub issues, but I'm guessing your research showed that it's the best option.

It is the most popular NPM package for profanity checks https://www.npmjs.com/search?q=keywords%3Aprofanity&ranking=popularity. Also, the issues on Github aren't serious. The implementation is so simple that it doesn't need frequent updates.

Doe this mean that it is possible to create a community with a name that is a swearword in some language, but then we won't be able to create a link that has the name of that community in it? That seems odd

In D8527#253676, @tomek wrote:

Can you provide some more context on the selection of this package? I noticed it hasn't been updated in 3 years and has some unaddressed GitHub issues, but I'm guessing your research showed that it's the best option.

It is the most popular NPM package for profanity checks https://www.npmjs.com/search?q=keywords%3Aprofanity&ranking=popularity. Also, the issues on Github aren't serious. The implementation is so simple that it doesn't need frequent updates.

Thanks for explaining!

In D8527#254082, @inka wrote:

Doe this mean that it is possible to create a community with a name that is a swearword in some language, but then we won't be able to create a link that has the name of that community in it? That seems odd

The name will eventually be encrypted, so we (as Comm) should have no way to ban it. On the other hand, the invite link will use our domain name in the future, so I think it makes sense to add some filtering there.

Can you clarify what will happen on older clients when this endpoint returns a ServerError that they aren't aware of?

EDIT

Looks like on older clients it will display offensive_words directly. But D8494 makes it so if a future keyserver returns an unknown error code to a future client, unknown error will be displayed instead.

This revision is now accepted and ready to land.Jul 27 2023, 6:08 PM

Can you clarify what will happen on older clients when this endpoint returns a ServerError that they aren't aware of?

EDIT

Looks like on older clients it will display offensive_words directly. But D8494 makes it so if a future keyserver returns an unknown error code to a future client, unknown error will be displayed instead.

Yes, that's exactly what will happen.