Skip to content

[CDAP-21270] Update DefaultJexlAllowlist and support constructors in allowlisted methods - #1050

Merged
riyaa14 merged 1 commit into
developfrom
fix/jexl-allowlist-feature
Sep 16, 2026
Merged

riyaa14 merged 1 commit into
developfrom
fix/jexl-allowlist-feature

Conversation

@riyaa14

@riyaa14 riyaa14 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Update the JEXL allowlist configuration to support constructor permissions and include standard EL function classes by default.

Changes

  • Default Allowlist: Added commonly used default EL function classes (io.cdap.functions.*, StringUtils, Strings, StringEscapeUtils, etc.) to DefaultJexlAllowlist.
  • Constructor Support: Updated JexlAllowlist validation to allow empty strings ("") in the methods list, which JEXL uses to represent class constructors.

@riyaa14
riyaa14 force-pushed the fix/jexl-allowlist-feature branch from d6e8d86 to 0f808fb Compare September 14, 2026 08:19

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +48 to +53
"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");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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 like coalesce, typeof, etc.)
  • io.cdap.functions.GeoFences (used for geo namespace functions)
  • io.cdap.cdap.api.common.Bytes (used for bytes namespace functions)

Without adding these to the default allowlist, standard EL expressions using these functions will fail when the JEXL allowlist is enabled.

Suggested change
"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");

@riyaa14
riyaa14 force-pushed the fix/jexl-allowlist-feature branch from 0f808fb to c7b5654 Compare September 15, 2026 07:29
@riyaa14
riyaa14 force-pushed the fix/jexl-allowlist-feature branch from c7b5654 to dc6a831 Compare September 16, 2026 08:56
@riyaa14
riyaa14 merged commit 2421ea4 into develop Sep 16, 2026
9 checks passed
@riyaa14
riyaa14 deleted the fix/jexl-allowlist-feature branch September 16, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants