Malware and profanity detection in user inputs

Hi @jagdish_bajaj,

This can be completed using a banned words API that will return a true or false, or you can do it in-house via the following method.

Firstly, you will need a data type setup to store your banned words. For this example, I’ve set it up like this:

Within the words list, I have the following words:

We need to set up some conditionals to check for these banned words.

Firstly, detecting banned word/s:

Simply splitting the value with a space will check for banned words, but users can bypass this filter by adding !/":*&*) or any other special characters. Because of this, I have added a find and replace using the following regex pattern [!@#$%^&*(),.?":{}|<>]. This will help to counteract any tricking of the filter.

We then intersect our current input against the search for the banned words’ first item (as we store all terms in a single list) and check that the count is not 0. If the count is > 0, then the conditional will return true.

For the no banned words found, we
check that the count is 0.

Here’s a GIF of it in action:
Untitled design (2)

This comment by @sam.morgan was extremely helpful for creating these workflows.

1 Like