Atlas icon indicating copy to clipboard operation
Atlas copied to clipboard

Implement bad words filter

Open pg9182 opened this issue 3 years ago • 1 comments

Required for feature parity with the old server, also supersedes R2Northstar/NorthstarMasterServer#66.

pg9182 avatar Oct 22 '22 15:10 pg9182

If someone wants to work on this:

  • First commit:
    • Create a new package pkg/badwords which contains badwords.go with a type List struct and at least the functions func ReadList(r io.Reader) (*List, error), func (l *List) AddWord(word string) (but don't need this if you're doing an optimized implementation which needs stuff to be precomputed) and func (l *List) Filter(s string) string.
    • It's up to you how to do the filtering, and while it should be efficient, it doesn't have to be optimal since we don't do it too often.
    • Adding a word doesn't need to be safe for concurrent use.
    • Create unit tests in badwords_test.go.
  • Second commit:
    • Add a config option in pkg/atlas, BadWordList string `env:"ATLAS_BADWORDS_LIST"`.
    • Read the word list from the provided filename and set the BadWords field of api0.Handler when creating a new *Server.

pg9182 avatar Oct 22 '22 22:10 pg9182