cloudera-scripts-for-log4j icon indicating copy to clipboard operation
cloudera-scripts-for-log4j copied to clipboard

Iterator File List for JAR Files When Looking for Class

Open belugabehr opened this issue 4 years ago • 1 comments

https://github.com/cloudera/cloudera-scripts-for-log4j/blob/7e3765001256abc3328018421850ff86a1f336f2/hdp_support_scripts/delete_jndi.sh#L31

I think it's more safe and proper to actually iterate the files in the JAR files instead of scanning through their binary contents:

 if unzip -l $jarfile | grep -q JndiLookup.class; then 

Should also be faster than the current implementation because the unzip utility knows how to quickly find the class names within the ZIP file dictionary without having to scan/read the entire file.

belugabehr avatar Dec 13 '21 18:12 belugabehr

In testing, the grep was faster, but we will note the suggestion.

jtran-cloudera avatar Dec 16 '21 00:12 jtran-cloudera