FrostCo / AdvancedProfanityFilter

A browser extension to filter profanity from webpages
GNU General Public License v3.0
164 stars 26 forks source link

Remove only whole word that matched listed words #62

Closed Abdillah closed 6 years ago

Abdillah commented 6 years ago

Description

Currently plugin remove any word contains character sequence listed in words. It makes non-profane words get filtered.

Details (Bugs Only)

Firefox Version: 58.0.2 (64-bit) Extension Version: 1.0.5 Operating System: MacOS 10.13.3 Site(s) Affected: Any site with login and word "Password" affected.

Steps to reproduce (Bugs only)

  1. Activate plugin
  2. Go to login page of any english site, "Password" label will be removed
richardfrost commented 6 years ago

I don't think the defaults should be affecting "Password". Would you mind going to the "Config" tab in the extensions settings and click the Export button? If you could then save that to a file and attach it here that would be helpful in figuring out what is going on, because that is definitely not the intended outcome.

Abdillah commented 6 years ago

It was because I use remove mode instead of sensor/substitute.

Config:

{
  "censorCharacter": "*",
  "censorFixedLength": 0,
  "defaultSubstitutions": [
    "censored",
    "expletive",
    "filtered"
  ],
  "disabledDomains": [],
  "filterMethod": 2,
  "globalMatchMethod": 3,
  "preserveFirst": false,
  "preserveLast": false,
  "showCounter": true,
  "substitutionMark": true,
  "words": {
    "": {
      "matchMethod": 0,
      "words": [
        "butt",
        "tail"
      ]
    },
    "": {
      "matchMethod": 1,
      "words": [
        "butthole",
        "jerk"
      ]
    },
    "": {
      "matchMethod": 1,
      "words": [
        "imperfect",
        "impure"
      ]
    },
    "": {
      "matchMethod": 1,
      "words": [
        "jerk"
      ]
    },
    "": {
      "matchMethod": 1,
      "words": [
        "explative"
      ]
    },
    "": {
      "matchMethod": 1,
      "words": [
        "dang",
        "darn"
      ]
    },
    "": {
      "matchMethod": 1,
      "words": [
        "freak",
        "fudge"
      ]
    },
    "": {
      "matchMethod": 1,
      "words": [
        "pee"
      ]
    },
    "": {
      "matchMethod": 0,
      "words": [
        "ticked"
      ]
    },
    "": {
      "matchMethod": 1,
      "words": [
        "imperfect",
        "impure"
      ]
    },
    "": {
      "matchMethod": 1,
      "words": [
        "crap",
        "crud",
        "poop"
      ]
    },
    "": {
      "matchMethod": 1,
      "words": [
        "explative"
      ]
    },
    "": {
      "matchMethod": 1,
      "words": [
        "harlot",
        "tramp"
      ]
    }
  }
}
richardfrost commented 6 years ago

Alright, so it looks like what is happening:

When you select "Remove" as the filter method, it ends up removing entire words that contain any of the words in the list. If you look at the word ass by default its set to an exact match (matchMethod = 0). Right now that matchMethod is being overpowered when in "Remove" mode, so it ends up removing any word that contains it. As you found, "password" would get completely removed.

To fix it right now - you can simply remove the word ass from the word list.

I am not sure which path I want to take to resolve this issue (Using the "Remove" filter). But I'm looking into it, so hopefully this won't be a problem anymore once I get that resolved.

richardfrost commented 6 years ago

Alright, I'm going to release a new version that will allow the "Remove" filter to support the exact matching method, which should fix the problem and allow it to work with the default word list.

richardfrost commented 6 years ago

I just published version 1.0.8 which should address this issue. If after the update you notice any trouble let me know so we can get to the bottom of it!

richardfrost commented 6 years ago

I'm going to go ahead and close this, but let me know if you are still having any trouble with this issue.