Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

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
Master 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
Master 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