Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate false negatives and profanities break censoring #31

Closed
TwiN opened this issue May 1, 2022 · 0 comments · Fixed by #32
Closed

Duplicate false negatives and profanities break censoring #31

TwiN opened this issue May 1, 2022 · 0 comments · Fixed by #32
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@TwiN
Copy link
Owner

TwiN commented May 1, 2022

Describe the bug

When a string has two false negatives and two profanities, the string is not censored properly.

What do you see?

println(goaway.Censor("document fuck document fuck"))

outputs

document **** ****ment fuck

For verbosity, note that by default, document is a false positive (meaning it should not be censored) and fuck is a profanity.

What do you expect to see?

The output should be:

document **** document ****

List the steps that must be taken to reproduce this issue

  1. Uncomment the test case that can be found at

    go-away/goaway_test.go

    Lines 148 to 152 in 3bf4c7a

    //{
    // input: "document fuck document fuck", // FIXME: This is not censored properly
    // expectedOutput: "document **** document ****",
    // expectedOutputWithoutSpaceSanitization: "document **** document ****",
    //},
  2. Run the tests
  3. Note how the new test case is failing

Version

v1.6.3

Additional information

I found this out while investigating #30

@TwiN TwiN added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels May 1, 2022
@TwiN TwiN closed this as completed in #32 May 5, 2022
TwiN pushed a commit that referenced this issue May 5, 2022
Closes #31 

Co-authored-by: Magnus Kraft <magnus.kraft@cybercom.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant