Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Detecting hidden characters NiFi

avatar
Contributor

Is there a processor that can detect hidden characters in NiFi?

 

In our test environment I am using an API invoke to deliver a JSON payload, for added security we want to filter out any hidden and potentially malicious text.

 

I have been trying to use RouteText, RouteOnContent and ExtractText processor to only allow alphanumeric and punctuation characters through but can't seem to get the regex to work when looking for 'uncommon' text or characters?

 

any help would be appreciated.

 

Andy 

2 ACCEPTED SOLUTIONS

avatar
Super Mentor

@Griggsy 

Here is an example of how you could use ReplaceText:

MattWho_0-1622833480773.png

Search value:

[^\w\d\r\n! @^$*#()_=<>~`|{}:;,.\-\\\?\/]+


The below site is a great way to test above regex against some sample data you have to make sure you are not missing any exceptions you want to keep
https://regex101.com/

It also explains this above regex formatting

If you found these responses helpful, please take a moment to login and click "Accept" on all solutions that help you.


Thanks,

Matt

 

View solution in original post

3 REPLIES 3

avatar
Super Mentor

@Griggsy 

Here is an example of how you could use ReplaceText:

MattWho_0-1622833480773.png

Search value:

[^\w\d\r\n! @^$*#()_=<>~`|{}:;,.\-\\\?\/]+


The below site is a great way to test above regex against some sample data you have to make sure you are not missing any exceptions you want to keep
https://regex101.com/

It also explains this above regex formatting

If you found these responses helpful, please take a moment to login and click "Accept" on all solutions that help you.


Thanks,

Matt

 

avatar
Contributor

Thanks for both replies, I managed to get it working last week the same way as you have shown Matt.

Cheers