tjackiw / obscenity

Obscenity is a profanity filter gem for Ruby/Rubinius, Rails (through ActiveModel), and Rack middleware.
MIT License
215 stars 98 forks source link

Whitelist should check the input text #25

Open fredxinfan opened 9 years ago

fredxinfan commented 9 years ago

The whitelist should be checking the input text instead of an item from the blacklist for the following reasons:

  1. There is no point to have the same word both in blacklist and whitelist. If the word shouldn't be considered as profane, simply remove it from the blacklist.
  2. By checking the input text in the whitelist will make Regex working better in the blacklist, e.g. "suckdicks" should be profane, but "DickSmith"(An Australian brand) should not be. So if we have "\wdicks\w" in the blacklist and "DickSmith" in the whitelist, we can easily by pass the check for "DickSmith" without miss checking any profane words contain "dicks".