Repository navigation
[CDAP-21270] Update DefaultJexlAllowlist and support constructors in allowlisted methods - #1050
Conversation
d6e8d86 to
0f808fb
Compare
There was a problem hiding this comment.
Code Review
This pull request adds commonly used EL functions to the default JEXL allowlist, updates the sanitization logic in JexlAllowlist to permit empty strings in methods, and introduces comprehensive deserialization unit tests. The review feedback correctly points out that several standard EL function classes (such as Global, GeoFences, and Bytes) are missing from the default allowlist, which would cause expressions using them to fail, and provides a code suggestion to include them.
| "io.cdap.functions.DateAndTime", "io.cdap.functions.Dates", | ||
| "io.cdap.functions.JsonFunctions", "io.cdap.wrangler.utils.DecimalTransform", | ||
| "io.cdap.wrangler.utils.ArithmeticOperations", "org.apache.commons.lang.StringUtils", | ||
| "com.google.common.base.Strings", "org.apache.commons.lang3.StringEscapeUtils", | ||
| "io.cdap.functions.DataQuality", "io.cdap.functions.DDL", "io.cdap.functions.Logical", | ||
| "io.cdap.functions.NumberFunctions"); |
There was a problem hiding this comment.
Several standard EL function classes registered in EL.DefaultFunctions are missing from the default JEXL allowlist:
io.cdap.functions.Global(used for global namespace functions likecoalesce,typeof, etc.)io.cdap.functions.GeoFences(used forgeonamespace functions)io.cdap.cdap.api.common.Bytes(used forbytesnamespace functions)
Without adding these to the default allowlist, standard EL expressions using these functions will fail when the JEXL allowlist is enabled.
| "io.cdap.functions.DateAndTime", "io.cdap.functions.Dates", | |
| "io.cdap.functions.JsonFunctions", "io.cdap.wrangler.utils.DecimalTransform", | |
| "io.cdap.wrangler.utils.ArithmeticOperations", "org.apache.commons.lang.StringUtils", | |
| "com.google.common.base.Strings", "org.apache.commons.lang3.StringEscapeUtils", | |
| "io.cdap.functions.DataQuality", "io.cdap.functions.DDL", "io.cdap.functions.Logical", | |
| "io.cdap.functions.NumberFunctions"); | |
| "io.cdap.functions.DateAndTime", "io.cdap.functions.Dates", | |
| "io.cdap.functions.JsonFunctions", "io.cdap.wrangler.utils.DecimalTransform", | |
| "io.cdap.wrangler.utils.ArithmeticOperations", "org.apache.commons.lang.StringUtils", | |
| "com.google.common.base.Strings", "org.apache.commons.lang3.StringEscapeUtils", | |
| "io.cdap.functions.DataQuality", "io.cdap.functions.DDL", "io.cdap.functions.Logical", | |
| "io.cdap.functions.NumberFunctions", "io.cdap.functions.Global", "io.cdap.functions.GeoFences", | |
| "io.cdap.cdap.api.common.Bytes"); |
0f808fb to
c7b5654
Compare
c7b5654 to
dc6a831
Compare
Summary
Update the JEXL allowlist configuration to support constructor permissions and include standard EL function classes by default.
Changes
io.cdap.functions.*,StringUtils,Strings,StringEscapeUtils, etc.) toDefaultJexlAllowlist.JexlAllowlistvalidation to allow empty strings ("") in themethodslist, which JEXL uses to represent class constructors.