A closing round bracket breaks word censoring

AI-generated summary

Users report a bug where a closing round bracket ) causes censored words to appear uncensored in Discourse, even when using smileys like :). rizka first documented the issue, showing that placing ) after a censored word reveals it. elijah confirmed the behavior with test cases, noting that the uncensoring only occurs when the censored word is preceded by an opening bracket (. ljpp attempted to reproduce it and noted the bug persists in Discourse 1.8. neil mentioned that the censored words setting has moved to “Watched Words” in 1.9, which supports wildcards like *, but it’s unclear if this fixes the bracket issue. ljpp asked whether the new system resolves the glitch. Mittineague cautioned that 100% censorship is currently unachievable, citing multiple bypass methods, and pointed to the relevant source code at censored-words.js.es6. The issue remains open and appears tied to how the engine processes punctuation during filtering.

I have recently been working on word censoring patterns to block some Finnish language expressions.

In the process, we discovered something I consider as a bug. I can reproduce it with censored words and censored patterns. Steps:

  1. Go to /admin/site_settings/category/posting.
  2. Scroll down and locate censored words and censored patterns.
  3. Censor something if you already haven’t.
  4. Open editor and write something nasty. You will see it censored like this: ■■■■■.
  5. Type a closing bracket ). Every censored word which precedes the bracket will show!

The closing bracket appears for instance in the common smiley :) which is converted to the respective emoji of course. So if you end your post with :), you can actually type anything you want without any censorship!

If it is not a real bug, feel free to merge these topics. :slight_smile:

1 Mi Piace

Yeah, I can reproduce. I added a nonsense word to my censored word lists. As one post:

:arrow_right:

But without the ( before the second gitorcz, both instances are not censored.

1 Mi Piace

Warning - dirty language follows. Are there any cencored words here?

Edit: Oops. At least not the most common curse words are cencored. I was trying to repro this issue here as this bug report is still valid in the 1.8 stable branch.

The censored words setting has been moved to a new UI “Watched Words” in 1.9. The censored patterns setting still exists, but the Watched Words lists can use * as a wildcards in the words. p*k for pork and punk.

5 Mi Piace

Thanks for the update. The bug report is about going around the word filter by using a round bracket, like the basic smiley:

:)

Have these changes a positive impact on this glitch?

I believe that short of moderation, no 100% censoring is currently possible.

A while back I experimented with trying different ways to get by the filter to post working censored links. With my admitted limited attempts I was very satisfied with the results - in terms of breaking censored links

In terms of words there are at least several ways to convey words or their meaning despite the censored word filtering. For example, I can type WHAT is this !#^*! and many would substitute the word themselves.

Anyway, AFAIK, the code of interest is
https://github.com/discourse/discourse/blob/master/app/assets/javascripts/pretty-text/censored-words.js.es6

1 Mi Piace