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]
Created 06-02-2021 11:27 AM
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
Created 06-03-2021 07:11 AM
Regex remove those bad characters
https://community.cloudera.com/t5/Support-Questions/Remove-from-a-flow-file-in-Nifi/td-p/109503
https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html
http://apache-nifi-users-list.2361937.n4.nabble.com/ReplaceText-and-special-characters-td480.html
Could also use UpdateRecord on Json with infer with replace or replaceregex
https://nifi.apache.org/docs/nifi-docs/html/record-path-guide.html
Created 06-04-2021 01:26 PM
@Griggsy
Here is an example of how you could use ReplaceText:
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
Created 06-03-2021 07:11 AM
Regex remove those bad characters
https://community.cloudera.com/t5/Support-Questions/Remove-from-a-flow-file-in-Nifi/td-p/109503
https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html
http://apache-nifi-users-list.2361937.n4.nabble.com/ReplaceText-and-special-characters-td480.html
Could also use UpdateRecord on Json with infer with replace or replaceregex
https://nifi.apache.org/docs/nifi-docs/html/record-path-guide.html
Created 06-04-2021 01:26 PM
@Griggsy
Here is an example of how you could use ReplaceText:
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
Created 06-07-2021 04:21 AM
Thanks for both replies, I managed to get it working last week the same way as you have shown Matt.
Cheers