You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by he...@apache.org on 2026/06/26 13:14:44 UTC

(commons-jexl) 01/01: JEXL-465, JEXL-464, JEXL-463 : the 3.7.0 release improvements;

This is an automated email from the ASF dual-hosted git repository.

henrib pushed a commit to branch JEXL-465
in repository https://gitbox.apache.org/repos/asf/commons-jexl.git

commit 1212144f7bed6e9630ff231fb82364c83caf420b
Author: Henrib <hb...@gmail.com>
AuthorDate: Fri Jun 26 15:14:27 2026 +0200

    JEXL-465, JEXL-464, JEXL-463 : the 3.7.0 release improvements;
    
    - SECURE permissions and hardened features become the default (no new, no global
      side-effects, no pragmas/annotations; lexical on, loops kept for scripts); add
      JexlBuilder.FULL and setDefaultFeatures to restore pre-3.7 behavior (JEXL-464)
    - add JexlConfigLoader to build an engine from YAML (JEXL-465)
    - add JexlPermissions.logging() to log allow/deny decisions; add SECURE constant (JEXL-463)
---
 RELEASE-NOTES.txt                                  | 903 +++++----------------
 pom.xml                                            |   6 +-
 src/changes/changes.xml                            |   7 +-
 .../java/org/apache/commons/jexl3/JexlBuilder.java |  88 +-
 .../org/apache/commons/jexl3/JexlConfigLoader.java | 595 ++++++++++++++
 .../jexl3/internal/introspection/Permissions.java  |  97 ++-
 .../internal/introspection/PermissionsParser.java  |  27 +-
 .../jexl3/internal/introspection/Uberspect.java    |   7 +-
 .../jexl3/introspection/JexlPermissions.java       | 204 ++++-
 .../org/apache/commons/jexl3/package-info.java     | 270 ++++--
 .../jexl3/scripting/JexlScriptEngineFactory.java   |   4 +-
 src/site/xdoc/index.xml                            |  87 ++
 src/site/xdoc/relnotes.xml                         | 117 ++-
 .../commons/jexl3/ComposePermissionsTest.java      |  10 +-
 .../org/apache/commons/jexl3/DefaultsTest.java     | 129 +++
 .../org/apache/commons/jexl3/Issues400Test.java    |  21 +
 .../apache/commons/jexl3/JexlConfigLoaderTest.java | 243 ++++++
 .../org/apache/commons/jexl3/JexlTestCase.java     |   4 +
 .../apache/commons/jexl3/LoggingPermissions.java   |  94 ---
 .../commons/jexl3/LoggingPermissionsTest.java      |  55 ++
 .../internal/introspection/PermissionsTest.java    | 102 +++
 .../jexl3/scripting/JexlScriptEngineTest.java      |  16 +-
 .../resources/org/apache/commons/jexl3/jexl.yaml   |  69 ++
 .../org/apache/commons/jexl3/test-config.yaml      |  31 +
 24 files changed, 2248 insertions(+), 938 deletions(-)

diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 74f9a09a..d7da0939 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -1,66 +1,59 @@
-Apache Commons JEXL 3.6.4 Release Notes
----------------------------------------
+Apache Commons JEXL 3.7.0 Release Notes
+========================================
 
-The Apache Commons JEXL team is pleased to announce the release of Apache Commons JEXL 3.6.4.
+The Apache Commons JEXL team is pleased to announce the release of Apache Commons JEXL 3.7.0.
 
 Introduction
-------------
+============
 
-Apache Commons JEXL is a library that enables scripting features in Java applications and frameworks..
+Apache Commons JEXL is a library that enables scripting features in Java applications and frameworks.
 
 This is a feature and maintenance release. Java 8 or later is required.
 
+Compatibility with previous releases
+=====================================
 
-Fixed Bugs
-----------
-
-o JEXL-462:  JexlPermissions.RESTRICTED must ensure a better level of isolation. 
-
-
+Version 3.7.0 is source and binary compatible with 3.6.x but changes default runtime and
+parse-time behavior (see below).
 
-Historical list of changes: https://commons.apache.org/proper/commons-jexl/changes.html
 
-For complete information on Apache Commons JEXL, including instructions on how to submit bug reports,
-patches, or suggestions for improvement, see the Apache Commons JEXL website:
+Breaking change in 3.7.0
+=========================
 
-https://commons.apache.org/proper/commons-jexl/
+Two defaults change:
 
-Download page: https://commons.apache.org/proper/commons-jexl/download_jexl.cgi
+  o The default permissions become SECURE — a minimum allow-list covering only safe java.lang
+    value types, java.math, and java.util. Everything else is denied unless explicitly composed in.
 
-Have fun!
--Apache Commons Team
+  o The default features disable new(...), global side-effects, pragmas, and annotations, and enable
+    lexical scoping; loops remain available to scripts (but never to expressions). Scripts using a
+    disabled construct will throw JexlException.Feature at parse time with the default engine.
 
-------------------------------------------------------------------------------
+To restore the previous (3.6.x) defaults, load the bundled jexl.yaml via JexlConfigLoader:
 
-Apache Commons JEXL 3.6.3 Release Notes
----------------------------------------
+    try (InputStream in = getClass().getResourceAsStream("/jexl.yaml")) {
+        JexlEngine engine = JexlConfigLoader.load(in).create();
+    }
 
-The Apache Commons JEXL team is pleased to announce the release of Apache Commons JEXL 3.6.3.
+Use JexlPermissions.logging() to discover which reflective elements the new algorithm denies.
 
-Introduction
-------------
 
-Apache Commons JEXL is a library that enables scripting features in Java applications and frameworks..
+New features
+============
 
-This is a feature and maintenance release. Java 8 or later is required.
+o JEXL-465:  Add JexlConfigLoader to build a JexlEngine from a YAML configuration (permissions,
+             features, arithmetic, namespaces, imports).
+o JEXL-464:  Default permissions are SECURE and default features harden parse-time behavior
+             (disable new, global side-effects, pragmas and annotations; enable lexical scoping;
+             loops remain available to scripts).
+o JEXL-463:  Add JexlPermissions.logging() to wrap a permission set and log which reflective
+             elements are allowed or denied.
 
 
 Fixed Bugs
-----------
-
-o JEXL-461:  Updates/improvements to the site documentation for JEXL Syntax. Thanks to David Costanzo. 
-o JEXL-459:  Empty/size functions swallow all exceptions with no trace. Thanks to Mirek Hankus. 
-o JEXL-458:  Improve permissions expressivity Thanks to Daniil Averin. 
-o JEXL-457:  Reduce default exposure for RESTRICTED JexlPermissions Thanks to Daniil Averin. 
-o JEXL-456:  Change in template parser behavior. Thanks to Vincent Bussol. 
-o          Fix the @return tags in the Javadoc for JexlArithmetic.toBigInteger() overloads (#403). Thanks to David Costanzo. 
-
-Changes
--------
+==========
 
-o          Bump org.apache.commons:commons-parent from 96 to 102. Thanks to Gary Gregory. 
-o          Bump commons-logging:commons-logging from 1.3.5 to 1.4.0. Thanks to Gary Gregory. 
-o          Bump com.google.code.gson:gson from 2.13.2 to 2.14.0. Thanks to Gary Gregory. 
+o JEXL-462:  JexlPermissions.RESTRICTED must ensure a better level of isolation.
 
 
 Historical list of changes: https://commons.apache.org/proper/commons-jexl/changes.html
@@ -75,7 +68,29 @@ Download page: https://commons.apache.org/proper/commons-jexl/download_jexl.cgi
 Have fun!
 -Apache Commons Team
 
-------------------------------------------------------------------------------
+
+========================================================================================================================
+Release 3.6.3
+========================================================================================================================
+
+Fixed Bugs
+==========
+
+o JEXL-461:  Updates/improvements to the site documentation for JEXL Syntax. Thanks to David Costanzo.
+o JEXL-459:  Empty/size functions swallow all exceptions with no trace. Thanks to Mirek Hankus.
+o JEXL-458:  Improve permissions expressivity. Thanks to Daniil Averin.
+o JEXL-457:  Reduce default exposure for RESTRICTED JexlPermissions. Thanks to Daniil Averin.
+o JEXL-456:  Change in template parser behavior. Thanks to Vincent Bussol.
+o            Fix the @return tags in the Javadoc for JexlArithmetic.toBigInteger() overloads (#403).
+             Thanks to David Costanzo.
+
+Changes
+=======
+
+o            Bump org.apache.commons:commons-parent from 96 to 102. Thanks to Gary Gregory.
+o            Bump commons-logging:commons-logging from 1.3.5 to 1.4.0. Thanks to Gary Gregory.
+o            Bump com.google.code.gson:gson from 2.13.2 to 2.14.0. Thanks to Gary Gregory.
+
 
 ========================================================================================================================
 Release 3.6.2
@@ -84,19 +99,20 @@ Release 3.6.2
 Version 3.6.2 is a minor release.
 
 Compatibility with previous releases
-====================================
+=====================================
 Version 3.6.2 is source and binary compatible with 3.6.
 
+Bugs Fixed
+==========
 
-Bugs Fixed in 3.6.2:
-====================
 o JEXL-455:  Tokenization error with multiline expressions.
 o JEXL-454:  Switch NaN case not found.
 o JEXL-453:  Finally clause is not evaluated.
 
-Changes in 3.6.2:
-=================
-o          Bump org.apache.commons:commons-parent from 93 to 96. Thanks to Gary Gregory.
+Changes
+=======
+
+o            Bump org.apache.commons:commons-parent from 93 to 96. Thanks to Gary Gregory.
 
 
 ========================================================================================================================
@@ -106,23 +122,24 @@ Release 3.6.1
 Version 3.6.1 is a minor release.
 
 Compatibility with previous releases
-====================================
+=====================================
 Version 3.6.1 is source and binary compatible with 3.6.
 
+Bugs Fixed
+==========
 
-Bugs Fixed in 3.6.1:
-====================
-* JEXL-452:     Debug setting in Engine shows class/method/line even when set to false.
-* JEXL-451:     Restore JexlSandbox permission capabilities on Object.class.
-* JEXL-450:     Disable instantiation of internal classes in RESTRICTED mode.
-* JEXL-449:     Inconsistency on nature of curly-bracket syntactic elements regarding annotations.
+o JEXL-452:  Debug setting in Engine shows class/method/line even when set to false.
+o JEXL-451:  Restore JexlSandbox permission capabilities on Object.class.
+o JEXL-450:  Disable instantiation of internal classes in RESTRICTED mode.
+o JEXL-449:  Inconsistency on nature of curly-bracket syntactic elements regarding annotations.
 
+Changes
+=======
 
-Changes in 3.6.1:
-=================
+o            Bump org.apache.commons:commons-parent from 91 to 93 #391, #396.
+             Thanks to Gary Gregory, Dependabot.
+o            Bump org.apache.commons:commons-lang3 from 3.17.0 to 3.20.0. Thanks to Gary Gregory.
 
-o               Bump org.apache.commons:commons-parent from 91 to 93 #391, #396. Thanks to Gary Gregory, Dependabot.
-o               Bump org.apache.commons:commons-lang3 from 3.17.0 to 3.20.0. Thanks to Gary Gregory.
 
 ========================================================================================================================
 Release 3.6.0
@@ -131,26 +148,35 @@ Release 3.6.0
 Version 3.6.0 is a minor release.
 
 Compatibility with previous releases
-====================================
+=====================================
 Version 3.6.0 is source and binary compatible with 3.5.
 
-
-What's new in 3.6.0:
-====================
+What's new
+==========
 Switch / case statements and expressions have been added to JEXL.
 
-New Features in 3.6.0:
-======================
-* JEXL-440:     Switch/case statement and expression
+New Features
+============
 
-Bugs Fixed in 3.6.0:
-====================
-* JEXL-447:     Regression in script-defined functions
-* JEXL-446:     ClassTool module inspection is too strict
-* JEXL-442:     Local variables are not resolved in interpolation string expression
-* JEXL-441:     Tokenization error if "\n" in template expression
-* JEXL-439:     When using reference capture, incorrect scoping when local variable redefines a captured symbol
-* JEXL-437:     Semicolons actually not optional between function calls on separate lines
+o JEXL-440:  Switch/case statement and expression.
+
+Bugs Fixed
+==========
+
+o JEXL-448:  Engines caching misses local variables handling and global eviction capability.
+o JEXL-447:  Regression in script-defined functions.
+o JEXL-446:  ClassTool module inspection is too strict.
+o JEXL-442:  Local variables are not resolved in interpolation string expression.
+o JEXL-441:  Tokenization error if "\n" in template expression.
+o JEXL-439:  When using reference capture, incorrect scoping when local variable redefines a captured symbol.
+o JEXL-437:  Semicolons not actually optional between function calls on separate lines.
+
+Changes
+=======
+
+o            Bump org.apache.commons:commons-parent from 81 to 91. Thanks to Gary Gregory.
+o            Bump org.apache.commons:commons-lang3 from 3.17.0 to 3.19.0. Thanks to Gary Gregory.
+o            Bump com.google.code.gson:gson from 2.13.1 to 2.13.2. Thanks to Gary Gregory.
 
 
 ========================================================================================================================
@@ -160,45 +186,42 @@ Release 3.5.0
 Version 3.5.0 is a minor release.
 
 Compatibility with previous releases
-====================================
+=====================================
 Version 3.5.0 is source and binary compatible with 3.4.
 
-
-What's new in 3.5.0:
+What's new in 3.5.0
 ====================
 Operator overloading has been enhanced so that overloading compare() will benefit all comparison operators.
 A feature flag has been introduced to allow pass-by-reference of captured variables closely mimicking
 EcmaScript behavior.
 
-New Features in 3.5.0:
-======================
-* JEXL-438:     Allow parser factory specification.
-* JEXL-428:     Make Comparable object high priority while comparing
-* JEXL-427:     Avoid coercing logical expressions to boolean
-* JEXL-426:     Enable pass-by-reference for Captured Variables
-o               Add and use CoercionException.CoercionException(String, Throwable). Thanks to Gary Gregory.
+New Features
+============
 
-Bugs Fixed in 3.5.0:
-====================
-* JEXL-436:     The increment (decrement) operator does not check for null operand
-* JEXL-435:     Changed behavior of empty operator overloading
-* JEXL-434:     The safe-access array operator is not safe
-* JEXL-433:     Debugger does not accept empty return statement
-* JEXL-432:     Namespace functors are not cleared when the classloader is updated
-* JEXL-431:     Parse error with variables declared in a catch clause
-* JEXL-429:     Ternary expression regression
-* JEXL-425:     Multiline format literals does not always return string
-o               Replace NumberParser use of Locale.ENGLISH with Locale.ROOT. Thanks to Gary Gregory.
-o               Pick up maven-antrun-plugin version from parent POM org.apache:apache. Thanks to Gary Gregory.
-
-Changes in 3.5.0:
-=================
-o               Bump org.apache.commons:commons-parent from 71 to 79 #279, #282, #287, #291, #295, #301. Thanks to Gary Gregory.
-o               Bump commons-logging:commons-logging from 1.3.2 to 1.3.5 #267, #280, #325.
-o               Bump org.codehaus.mojo:animal-sniffer-maven-plugin from 1.23 to 1.24 #266.
-o               Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.17.0 #270, #274, #283.
-o               Bump org.ow2.asm:asm from 9.7 to 9.7.1 #294. Thanks to Dependabot, Gary Gregory.
-o               Bump com.google.code.gson:gson from 2.11.0 to 2.13.0 #321. Thanks to Dependabot, Gary Gregory.
+o JEXL-438:  Allow parser factory specification.
+o JEXL-428:  Make Comparable object high priority while comparing.
+o JEXL-427:  Avoid coercing logical expressions to boolean.
+o JEXL-426:  Enable pass-by-reference for Captured Variables.
+
+Bugs Fixed
+==========
+
+o JEXL-436:  The increment (decrement) operator does not check for null operand.
+o JEXL-435:  Changed behavior of empty operator overloading.
+o JEXL-434:  The safe-access array operator is not safe.
+o JEXL-433:  Debugger does not accept empty return statement.
+o JEXL-432:  Namespace functors are not cleared when the classloader is updated.
+o JEXL-431:  Parse error with variables declared in a catch clause.
+o JEXL-429:  Ternary expression regression.
+o JEXL-425:  Multiline format literals does not always return string.
+
+Changes
+=======
+
+o            Bump org.apache.commons:commons-parent from 71 to 79. Thanks to Gary Gregory.
+o            Bump commons-logging:commons-logging from 1.3.2 to 1.3.5.
+o            Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.17.0. Thanks to Gary Gregory.
+o            Bump com.google.code.gson:gson from 2.11.0 to 2.13.0. Thanks to Dependabot, Gary Gregory.
 
 
 ========================================================================================================================
@@ -208,56 +231,52 @@ Release 3.4
 Version 3.4 is a minor release.
 
 Compatibility with previous releases
-====================================
+=====================================
 Version 3.4 is source and binary compatible with 3.3.
 
-
-What's new in 3.4:
+What's new in 3.4
 ==================
 Features and permissions are easier to define through new methods.
-Some new syntaxes are introduced (thus the new minor); try/catch/finally (including with resources),
-an array-access safe navigation ((x?[y]), strict equality/inequality operators (===, !==) and
-more permissive structured literals. See the JIRA tickets for more details.
+Some new syntaxes are introduced (thus the new minor): try/catch/finally (including with resources),
+an array-access safe navigation (x?[y]), strict equality/inequality operators (===, !==) and
+more permissive structured literals.
+
+New Features
+============
+
+o JEXL-423:  Add support for instanceof / !instanceof.
+o JEXL-422:  Add strict equality (===) and inequality (!==) operators.
+o JEXL-421:  ArrayBuilder: array type should reflect common class of its entries.
+o JEXL-419:  Add permission syntax to allow class/method/field.
+o JEXL-418:  Add try-catch-finally support.
+o JEXL-408:  Using JexlFeatures is tedious.
+o JEXL-404:  Support array-access safe navigation (x?[y]).
+o JEXL-401:  Captured variables should be read-only.
+o JEXL-398:  Allow 'trailing commas' or ellipsis while defining array, map and set literals.
+
+Bugs Fixed
+==========
+
+o JEXL-420:  Error while comparing float and string value.
+o JEXL-417:  JexlArithmetic looses precision during arithmetic operator execution.
+o JEXL-416:  Null-valued pragma throws NPE in 3.3.
+o JEXL-415:  Incorrect template eval result.
+o JEXL-414:  SoftCache may suffer from race conditions.
+o JEXL-412:  Ambiguous syntax between namespace function call and map object definition.
+o JEXL-410:  JexlFeatures: ctor does not enable all features.
+o JEXL-409:  Disable LEXICAL should disable LEXICAL_SHADE.
+o JEXL-405:  Recursive functions corrupt evaluation frame if reassigned.
+o JEXL-403:  Exception while evaluating template literal used in array assignment in loop.
+o JEXL-402:  Parse failed with empty return value.
+
+Changes
+=======
+
+o            Bump commons-parent from 57 to 70. Thanks to Gary Gregory, Dependabot.
+o            Bump org.ow2.asm:asm from 9.5 to 9.7. Thanks to dependabot.
+o            Bump commons-logging from 1.2 to 1.3.2. Thanks to Gary Gregory, Dependabot.
+o            Bump com.google.code.gson:gson from 2.10.1 to 2.11.0. Thanks to Gary Gregory, Dependabot.
 
-New Features in 3.4:
-====================
-* JEXL-423:     Add support for instanceof / !instanceof
-* JEXL-422      Add strict equality (===) and inequality (!==) operators
-* JEXL-421:     ArrayBuilder: array type should reflect common class of its entries
-* JEXL-419:     Add permission syntax to allow class/method/field
-* JEXL-418:     Add try-catch-finally support
-* JEXL-408:     Using JexlFeatures is tedious
-* JEXL-404:     Support array-access safe navigation (x?[y])
-* JEXL-401:     Captured variables should be read-only
-* JEXL-398:     Allow 'trailing commas' or ellipsis while defining array, map and set literals
-o               Add Maven property project.build.outputTimestamp for build reproducibility. Thanks to Gary Gregory.
-
-Bugs Fixed in 3.4:
-==================
-* JEXL-420:     Error while comparing float and string value
-* JEXL-417:     JexlArithmetic looses precision during arithmetic operator execution
-* JEXL-416:     Null-valued pragma throws NPE in 3.3
-* JEXL-415:     Incorrect template eval result
-* JEXL-414:     SoftCache may suffer from race conditions
-* JEXL-412:     Ambiguous syntax between namespace function call and map object definition.
-* JEXL-410:     JexlFeatures: ctor does not enable all features
-* JEXL-409:     Disable LEXICAL should disable LEXICAL_SHADE
-* JEXL-405:     Recursive functions corrupt evaluation frame if reassigned
-* JEXL-403:     Exception while evaluating template literal used in array assignment in loop.
-* JEXL-402:     parse failed with empty return value.
-o               [StepSecurity] ci: Harden GitHub Actions #180. Thanks to step-security-bot, Gary Gregory.
-o               Guard logging calls. Thanks to PMD, Gary Gregory.
-o               Deprecate SimpleNode.SimpleNode(Parser, int) in favor of SimpleNode.SimpleNode(int). Thanks to PMD, Gary Gregory.
-o               Deprecate JexlNode.JexlNode(Parser, int) in favor of JexlNode.JexlNode(int). Thanks to PMD, Gary Gregory.
-
-Changes in 3.4:
-===============
-o              Bump commons-parent from 67 to 69. Thanks to dependabot.
-o              Bump github actions. Thanks to dependabot.
-o              Bump commons-parent from 57 to 70. Thanks to Gary Gregory, Dependabot.
-o              Bump org.ow2.asm:asm from 9.5 to 9.7 #200, #242. Thanks to dependabot.
-o              Bump commons-logging from 1.2 to 1.3.2 #241, #255. Thanks to Gary Gregory, Dependabot.
-o              Bump com.google.code.gson:gson from 2.10.1 to 2.11.0 #258. Thanks to Gary Gregory, Dependabot.
 
 ========================================================================================================================
 Release 3.3
@@ -266,19 +285,20 @@ Release 3.3
 Version 3.3 is a minor release.
 
 Compatibility with previous releases
-====================================
+=====================================
 Version 3.3 is source and binary compatible with 3.2.
 However, the default setting for permissions that determine which packages, classes and methods are accessible
 to scripts has been reduced to a very narrow set. When migrating from previous version of JEXL, this may result
-in breaking your application behavior ; this breaking change requires remediation in your code.
+in breaking your application behavior; this breaking change requires remediation in your code.
 Despite the obvious inconvenience - our sincere apologies on the matter -, how much functional and semantic power is
-accessible through scripts has a real impact on your application security and stability ; that potential risk requires
+accessible through scripts has a real impact on your application security and stability; that potential risk requires
 an informed review and conscious choice on your end.
-To mitigate the change, you can revert to the previous behavior with one line of code  (see JexlPermissions, JexlBuilder
-and JexlScriptEngine) or use this opportunity to reduce exposure. Whether Files, URLs, networking, processes,
-class-loaders or reflection classes or whether loops or side effects are accessible are part of your choice to make.
+To mitigate the change, you can revert to the previous behavior with one line of code (see JexlPermissions,
+JexlBuilder and JexlScriptEngine) or use this opportunity to reduce exposure. Whether Files, URLs, networking,
+processes, class-loaders or reflection classes or whether loops or side effects are accessible are part of your
+choice to make.
 
-What's new in 3.3:
+What's new in 3.3
 ==================
 JEXL 3.3 brings the ability to configure permissions on libraries in the manner pioneered
 with the @NoJexl annotation on source code. This is achieved through a crude but light mechanism akin to
@@ -288,535 +308,42 @@ allow fine-tuning the end-user freedom and scripting integration through syntact
 JEXL 3.3 also adds some syntactic (ECMAScript) features (let, const, =>, for, ...) to further reduce
 the skill set required to write scripts.
 
-New Features in 3.3:
-====================
-* JEXL-392:     Enable namespace declaration based on scripts
-* JEXL-391:     Improve in/=~ operator when arguments are arrays and collections
-* JEXL-390:     Pragmas should not be statements
-* JEXL-389:     Improve parsing timings
-* JEXL-385:     Support disabling fortran-style relational operators syntax
-* JEXL-382:     Simplify grammar and lexical state management
-* JEXL-380:     Multiple values per pragma key
-* JEXL-379:     Allow new to use class identifier
-* JEXL-373:     Add support for prefix/postfix increment/decrement operators
-* JEXL-372:     Add support for 'standard' for loop
-* JEXL-369:     Add 'let' and 'const' variable declarations
-* JEXL-367:     Named function and fat-arrow (=>) lambda syntax
-* JEXL-366:     Fail to evaluate string and number comparison
-* JEXL-365:     Lambda expressions
-* JEXL-363:     Allow retrieving captured variables in script
-* JEXL-360:     Add missing bitshift operators ( >>, >>>, <<)
-* JEXL-359:     Allow per-operator arithmetic handling of null arguments
-* JEXL-357:     Configure accessible packages/classes/methods/fields
-
-Bugs Fixed in 3.3:
-==================
-* JEXL-386:     Non-inheritable permissions on interfaces are ignored in an inheritable sandbox
-* JEXL-384:     Improve control over JexlArithmetic null argument handling
-* JEXL-378:     Incremental operator and decremental operator do not honor the side-effect flag
-* JEXL-376:     Introspector captures methods on non-exported classes (modules, java9+)
-* JEXL-375:     Cannot access enums by their name when using sandbox
-* JEXL-374:     No exception if dereferencing null object using safe(false) and antish(false)
-* JEXL-371:     Override of a protected method with public visibility is not callable
-* JEXL-370:     Cannot check if variable is defined using ObjectContext if the value is null
-* JEXL-368:     Namespace functor resolution is not cached
-* JEXL-364:     Evaluator options not propagated in closures
-* JEXL-362:     JexlInfo position reporting is off
-* JEXL-361:     Null may be used as operand silently even in arithmetic strict(true) mode
-* JEXL-354:     #pragma does not handle negative integer or real literals
-* JEXL-353:     Documentation error for not-in/not-match operator
-
-========================================================================================================================
-Release 3.2.1
-========================================================================================================================
-
-Version 3.2.1 is a maintenance release.
-
-Compatibility with previous releases
-====================================
-Version 3.2.1 is source and binary compatible with 3.2.
-
-Bugs Fixed in 3.2.1:
-==================
-* JEXL-352:      Possible memory leak regarding parser jjtree nodes in JEXL 3.2
-* JEXL-351:      JXLT Template fails when using sandboxing
-* JEXL-350:      map[null] throws "unsolvable property" when a Sandbox is used
-
-========================================================================================================================
-Release 3.2
-========================================================================================================================
-
-Version 3.2 is a minor release.
-
-Compatibility with previous releases
-====================================
-Version 3.2 is binary compatible with 3.1. However, JEXL now requires Java 8 or above.
-
-Unfortunately, it is not strictly source compatible. This release does break source compatibility by adding methods to existing
-interfaces and an abstract method to an abstract class. However, since these interfaces and class are not expected to be implemented
-or derived by code external to the JEXL project, this compatibility break should remain unnoticeable.
-It is nevertheless possible and we are sorry if it causes problems to any of you.
-
-What's new in 3.2:
-==================
-* Lexical scoping for local variables and parameters allowing at parse and/or runtime to reduce scripting errors and bugs and align with
-  known development languages best practice (C, Java, ...).
-* Interpolated strings in identifiers, as in x.`${prefix}_${suffix}` that in many cases would be equivalent to
-  x[prefix + '_' + suffix] or x[`${prefix}_${suffix}`].
-* Safe-navigation mode and operator '?.' allowing lenient handling of non-existent or null properties so that an expression
-  like 'x?.y?.z' would behave as 'x.y.z' in nominal execution and return null instead of throwing an exception in error
-  cases. The safe() option on the builder enables the behavior making '.' and '[...]' behave as '?.'.
-* A set of syntactic restrictions can be applied to scripts ranging from not allowing side-effects to not allowing
-  loops enabling fine control over what end-users may be able to enter as expressions/scripts.
-
-New Features in 3.2:
-====================
-* JEXL-344:      Don't fill stack trace for JexlExpression#Return (to improve performance)
-* JEXL-334:      Remove offensive terminology from code and API
-* JEXL-333:      Allow declaration of namespace within script
-* JEXL-317:      Support script cancellation through less invasive API
-* JEXL-307:      Variable redeclaration option
-* JEXL-295:      Add unary plus operator
-* JEXL-292:      Allow specifying custom Permissions class for Uberspect to be used later by Introspector
-* JEXL-288:      Annotation can not be specified for a standalone statement
-* JEXL-275:      Allow safe navigation as option
-* JEXL-274:      Handle soft and hard stack overflow
-* JEXL-273:      Add do...while(...) loops
-* JEXL-264:      Allow space, quote & double-quote in identifiers
-* JEXL-260:      Automatically inject JexlContext in constructor call when possible
-* JEXL-253:      Permissions by super type in JexlSandbox
-* JEXL-252:      Allow for interpolated strings to be used in property access operators
-* JEXL-250:      Safe navigation operator (?.)
-* JEXL-249:      Java 1.8 as minimum supported version
-* JEXL-248:      Allow range subexpression as an array property assignment identifier
-* JEXL-243:      Allow restricting available features in Script/Expressions
-* JEXL-238:      Restrict getLiteralClass to a Number for NumberLiterals
-* JEXL-237:      Ability to restrict usage of certain names when declaring local variables
-* JEXL-236:      Support CharSequence in size(), empty() and contains() operators
-* JEXL-234:      Extend application of operators startsWith and endsWith from String to CharSequence types
-* JEXL-226:      Add ?? operator support
-* JEXL-224:      The ability to overload call() operator in customized JexlArithmetic implementation
-* JEXL-212:      Restrict usage of assignment statements in JexlExpression
-* JEXL-175:      java.util.regex.Pattern creation operator (regex literals)
-
-Bugs Fixed in 3.2:
-==================
-* JEXL-349:      Script valid in 3.0 no longer valid
-* JEXL-348:      Parsing error when mixing namespaces with conditional expressions
-* JEXL-347:      Missing unsolvable property exception for reference when used with equals
-* JEXL-346:      namespace function syntax leads to strange error for "common case" of ternary operator
-* JEXL-336:      Escape some control characters
-* JEXL-331:      Please document \uXXXX escape sequence
-* JEXL-330:      JexlException.Parsing.getMessage() throws exception when parse error is in long expression
-* JEXL-328:      JXLT template scripts evaluation do not process pragmas
-* JEXL-327:      map[null] does not work in assignment context
-* JEXL-326:      Link to "JavaCC" on syntax reference page is broken
-* JEXL-325:      Potential race-condition in NumberParser.toString()
-* JEXL-324:      JexlEngine.createExpression("new()").getParsedText() throws NPE
-* JEXL-323:      Ant-style variables can throw exception when evaluated for their value
-* JEXL-322:      JXLT String literals cannot contain curly brace
-* JEXL-321:      Empty do-while loop is broken
-* JEXL-320:      "mvn test" fails with COMPILATION ERROR in SynchronizedArithmetic.java on Java 11
-* JEXL-319:      Apache project documentation gives instructions in subversion
-* JEXL-318:      Annotation processing may fail in lexical mode
-* JEXL-315:      JxltEngine literal string strings ending in \ $ or # throw JxltEngine$Exception
-* JEXL-314:      Comparison NULL values of variables NAME1.NAME2
-* JEXL-312:      @NoJexl fails to disallow method call
-* JEXL-311:      Jxlt template scripts fail using verbatim expressions embedded in lambdas
-* JEXL-309:      Line numbers are not correct when template report errors
-* JEXL-306:      Ternary operator ? protects also its branches from resolution errors
-* JEXL-305:      Script debugger produces incorrect syntax
-* JEXL-304:      Error parsing overview.limit.var
-* JEXL-303:      Block syntax is broken
-* JEXL-302:      JexlScript.getVariables returns strange values for array access
-* JEXL-301:      Array access operator does not fail on null object in non-strict arithmetic mode
-* JEXL-300:      Ant-ish variables should not use safe-access operator syntax
-* JEXL-299:      Improve message error when method could not be found
-* JEXL-298:      Unable to call 'empty' and 'size' member methods with parameters
-* JEXL-296:      Real literal in scientific format is not parsed without suffix
-* JEXL-291:      Using sandbox prevents array-syntax lookup by number in Map
-* JEXL-290:      Safe navigation fails on chained method calls
-* JEXL-289:      Passing undeclared function parameter can overwrite a local function variable
-* JEXL-287:      Wrong resolution of local variables
-* JEXL-286:      For statement without a body should update its variable
-* JEXL-285:      For statement variable may seem unaffected by iteration
-* JEXL-282:      Pragmas with antish names are broken
-* JEXL-281:      MethodExecutor incorrectly tests for empty parameters list
-* JEXL-280:      break/continue statements outside of the loop
-* JEXL-279:      Null variables property access do not throw exceptions
-* JEXL-278:      Ambiguous exceptions should point to actual statement ambiguity
-* JEXL-272:      Dereferencing null property not reported on method call
-* JEXL-271:      Hoisted variable is lost when currying lambda
-* JEXL-270:      Wrong Script$Curried creation when script.curry() method is called inside script
-* JEXL-261:      JexlEngine.setClassLoader(...) should reload namespaces that are classes
-* JEXL-257:      Function throwing IllegalArgumentException may be called twice
-* JEXL-246:      Intermittent ambiguous method invocation when processing assignOverload
-* JEXL-245:      Engine in strict mode fails to fail on unsolvable variables or properties
-* JEXL-244:      Webapp classloader memory leaks
-* JEXL-241:      NPE when script containing string interpolation executed in multiple threads
-* JEXL-240:      Unable to invoke a call operator using antish style variable resolution
-* JEXL-231:      Syntax for accessing List elements is not mentioned in docs
-* JEXL-230:      List literal is not mentioned in docs
-* JEXL-227:      JexlScriptEngineFactory.getEngineVersion() should return actual version
-* JEXL-225:      Incorrect invoking methods with ObjectContext
-
-There are no other changes.
-
-
-========================================================================================================================
-Release 3.1
-========================================================================================================================
-
-Version 3.1 is a minor release.
-
-Compatibility with previous releases
-====================================
-Version 3.1 is binary compatible with 3.0.
-
-However it is not source compatible, this release does break source compatibility by adding methods to existing
-interfaces; these interfaces are however not expected to be implemented by code external to the JEXL project.
-This compatibility break should remain hypothetical. It is nevertheless possible and we are sorry if it causes problems
-to any of you.
-If you encounter this issue, besides continuing using JEXL 3.0, your code likely delegates method calls to JEXL3 objects
-and you shall be able to continue doing so with these new methods.
-
-The three interfaces and methods are:
-
-1 - 'isCancellable()' in interface org.apache.commons.jexl3.JexlEngine$Options
-2 - 'callable(JexlContext)' in interface org.apache.commons.jexl3.JexlExpression
-3 - 'getPragmas()' in interface org.apache.commons.jexl3.JxltEngine$Template
-
-What's new in 3.1:
-==================
-* Annotations syntax (@annotation) and processing capabilities.
-  Annotations in JEXL are 'meta-statements'; they allow to wrap the execution of the JEXL statement in a user provided
-  caller; a typical example would be: ""@synchronized(x) x.someMethod();". Annotations may be declared with zero or more
-  parameters. Annotation processing is implemented by providing a JexlContext.AnnotationProcessor; its processAnnotation
-  method will call the annotated statement encapsulated in a Callable. Annotation arguments are evaluated and passed
-  as arguments to processAnnotation.
-* Better support for script execution options, error handling and cancelling.
-* All operators can be overloaded.
-
-New Features in 3.1:
-====================
-* JEXL-222:     The ability to declare indexed property getter/setter in customized JexlArithmetic implementation
-* JEXL-219:     Blacklist by default in sandbox
-* JEXL-216:     Improve parsing concurrency in multithreaded environment
-* JEXL-211:     Add callable method to JexlExpression interface
-* JEXL-201:     Allow Interpreter to use live values from JexlEngine.Option interface implemented by JexlContext
-* JEXL-198:     JxltEngine Template does not expose pragmas
-* JEXL-197:     Add annotations
-* JEXL-194:     Allow synchronization on iterableValue in foreach statement
-
-Bugs Fixed in 3.1:
-==================
-* JEXL-221:     Sporadic undefined property error caused by NPE at MapGetExecutor.tryInvoke()
-* JEXL-217:     Interpreter.getAttribute() raises exception in non-strict mode when cached property resolver is used
-* JEXL-215:     JexlEngine.createInfo() is redundantly called when debug and caching is enabled leading to sub-optimal performance
-* JEXL-214:     Redundant call of fillInStackTrace() in JexlEngine.createInfo() ?
-* JEXL-213:     rename JexlBuilder.loader(Charset arg) to JexlBuilder.charset(Charset arg)
-* JEXL-210:     The way to cancel script execution with an error
-* JEXL-209:     Unsolvable function/method '<?>.<null>(...)'
-* JEXL-208:     Documentation typos/inconsistencies
-* JEXL-207:     Inconsistent error handling
-* JEXL-206:     testCallableCancel() test hangs sporadically
-* JEXL-205:     testCancelForever() is not terminated properly as 'Fixed'
-* JEXL-204:     Script is not interrupted by a method call throwing Exception
-* JEXL-203:     JexlArithmetic.options() diverts Interpreter to use default implementation of JexlArithmetic instead of custom one
-* JEXL-202:     Detect invalid assignment operator usage with non-assignable l-value during script parsing
-* JEXL-196:     Script execution hangs while calling method with one argument without parameter
-* JEXL-195:     Support for AtomicBoolean in logical expressions
-* JEXL-193:     InterruptedException is swallowed in function call in silent and non-strict mode
-* JEXL-192:     Invalid return type when expected result is null
-* JEXL-191:     Jexl3 unsolvable property exception when using enum
-* JEXL-190:     local function within context is not resolved if function resolver class without namespace is specified
-* JEXL-189:     Possible bug in Interpreter.isCancelled()
-* JEXL-188:     Possible bug in JexlArithmetic.isFloatingPointNumber()
-* JEXL-187:     Jexl Syntax doc does not mention 'continue' and 'break' operators
-* JEXL-186:     Performance regression in arithmetic operations compared to JEXL 2.1
-
-
-========================================================================================================================
-Release 3.0
-========================================================================================================================
-
-Version 3.0 is a major release changing the public JEXL API.
-
-Due to binary and source incompatibilities and the scope of modifications, JEXL has moved to the
-org.apache.commons.jexl3 package.
-However, this is a drop-in replacement through JSR-223 and casual code usage should find easy equivalence between
-jexl-2.x and 3.x (besides the package name).
-Also note that JEXL 3.0 now requires Java 6.
-
-
-What's new in 3.0:
-==================
-* A redesigned API that properly segregates the "public" part and the "internal" parts of JEXL.
-* A real difference between Expression and Script (scripts accept statements: for, while, etc).
-* The ability to create JEXL functions in script, closure/variables hoisting/currying included.
-* A set of assignment operators (+=, *= , ...).
-* A set of String matching operators (^= startsWith, $= endsWith) and their negative counterparts (!^, !$)
-* A range operator (x .. y) to ease writing loops (for(var x : 1 .. 10) ... )
-* A literal set syntax to ease creating sets: { 1, 2...}
-
-New features in 3.0:
-====================
-* JEXL-178:     'Unsolvable property' message to provide details about underlying exception
-* JEXL-177:     Unified expressions to be used in String literals in JEXL scripts
-* JEXL-176:     Synonym operator name 'in' for operator =~ // Remove 'foreach...in' syntax
-* JEXL-174:     Overloadable property access operators
-* JEXL-173:     Duck-typed java closures
-* JEXL-170:     Implement assignment operators
-* JEXL-164:     public getters for high/low properties for IntegerRange and LongRange
-* JEXL-152:     Extend Range literal to support Long values
-* JEXL-149:     Set Construction as per EL 3.0 spec
-* JEXL-133:     String matching Operator short-hand inspired by CSS3
-* JEXL-128:     ObjectContext<> should implement NamespaceResolver
-* JEXL-127:     Allow the creation of functions
-* JEXL-123:     Redesign API for stability
-* JEXL-122:     Move JEXL from org.apache.comms.jexl2 to org.apache.commons.jexl3
-* JEXL-136:     Script calls within scripts may fail with number arguments
-* JEXL-135:     Using map as script parameter or local variable
-* JEXL-134:     Issue with evaluation of concat of variables : \r + \n gives 0
-* JEXL-131:     UnifiedJexl parsing may fail with NPE
-* JEXL-130:     Ternary Conditional fails for Object values
-* JEXL-126:     Decimal numbers literals should be 'double' by default (instead of 'float')
-
-
-Bugs Fixed in 3.0:
-==================
-* JEXL-184:     dot-ed identifiers parsing failure
-* JEXL-180:     Documentation - suggests using float for financials
-* JEXL-171:     Map access operator does not work if key name clashes with map property name
-* JEXL-169:     A string is wrongly identified as FloatingPointNumber
-* JEXL-168:     Dedicated operator for String concatenation
-* JEXL-79:      Add support for growable arrays (ArrayLists)
-* JEXL-167:     Possible loss of value when converting BigDecimal to BigInteger
-* JEXL-166:     Incorrect operator symbol for bitwise complement in jexlArithmetic
-* JEXL-163:     empty(new ("java.lang.Long", 4294967296)) returns true
-* JEXL-162:     empty() function throws an exception : unsupported type
-* JEXL-160:     typo in package.html
-* JEXL-158:     Handle locale decimal separators correctly
-* JEXL-157:     Replace File.pathSeparator with File.separator
-* JEXL-146:     Performance problem in Interpreter.unknownVariable mechanism
-* JEXL-145:     Sandbox calling wrong check (classname vs class)
-* JEXL-144:     Empty array property setting fails
-* JEXL-142:     Map expression issue with empty key
-* JEXL-141:     Suffix for Big Decimal and Big Integer Literal is incorrectly mentioned in Java docs
-* JEXL-137:     Invalid script variable list for nested array/map access
-
-Detail of all changes in changes.xml.
-
-
-========================================================================================================================
-Release 2.1.1
-========================================================================================================================
-
-Version 2.1.1 is a micro release to fix a regression detected in 2.1:
-
-* JEXL-124:     Array parameters to methods don't work anymore (JEXL 2.1.1)
-
-There are no other changes.
-
-
-========================================================================================================================
-Release 2.1
-========================================================================================================================
-
-Version 2.1 is a minor release adding new features and fixing known issues detected in 2.0.
-
-Compatibility with previous releases
-====================================
-Version 2.1 is binary compatible with 2.0.1.
-
-However it is not source compatible.
-New methods have been added to the org.apache.commons.jexl2.Script and org.apache.commons.jexl2.JexlInfo interfaces.
-Any source code that implements these interfaces will need to be updated.
-
-What's new in 2.1:
-==================
-* A more thorough arithmetic (JexlArithmetic) that allows fine control over decimals (scale and precision), a
-  new syntax for numeric literals (OGNL inspired Big and Huge notations) and a better type handling keeping the most
-  appropriate representation in casual operations.
-* The introduction of script variables and parameters that reduce context dependencies and methods; this allows to
-  perform checks after script creation (light static checking hints). Plus the ability to call script from scripts.
-* A sandoxing feature to restrict and rename what JEXL can access from the environment allowing tighter control over security.
-* Extensions to UnifiedJEXL that allow the creation of templates.
-
-New features in 2.1:
-====================
-* JEXL-114:     Allow scripts to create local variables // Add return keyword
-* JEXL-113:     Add functions to extract which variables, parameters and local variables are used to evaluate a script
-* JEXL-118:     Provide an IN operator
-* JEXL-115:     Add support for asynchronous script execution and cancellation
-* JEXL-116:     Add control over classes, methods, constructors and properties allowed in scripts
-* JEXL-120:     Add simple template features
-* JEXL-119:     Allow indexed properties container resolution in expressions
-* JEXL-106:     When divide two BigDecimal values in an expression it results in java.lang.ArithmeticException
-* JEXL-102:     Add "jexl2" as a supported name
-
-Bugs Fixed in 2.1:
-==================
-* JEXL-83:      Make JexlArithmetic immutable (and threadsafe)
-* JEXL-24:      Support Long for integer literal instead of Integers
-* JEXL-107:     literals and parenthesized expressions can not be used as references
-* JEXL-108:     parsing error if i define a empty literal array/map
-* JEXL-101:     Vararg methods where the first argument is no vararg can not be called with only the fixed parameters given
-* JEXL-105:     Array literals are considered constant even when they are not
-* JEXL-104:     NPE in JexlArithmetic when an Array-Expression containing a null is used.
-* JEXL-112:     Cannot parse Integer.MIN_VALUE
-* JEXL-111:     expression execute error
-
-Bugs fixed in 2.0.1:
-====================
-
-* JEXL-100:     Array access expressions fail when evaluated twice and cache is enabled
-* JEXL-99:      Documentation of Thread Safety / Invalid code examples on homepage
-* JEXL-98:      Quote escaping cannot be escaped
-
-
-2.0
-==================
-
-Bugs fixed in 2.0:
-==================
-
-* JEXL-90:      JEXL parser allows invalid expressions, e.g. "a=1 b=2 3"
-* JEXL-88:      MethodKey.java - name clash getMostSpecific() with Java 1.5.0
-* JEXL-87:      Inconsistent behavior of arithmetical operations
-* JEXL-81:      Introspector does not use ListGetExecutor for List
-* JEXL-80:      Lenient mode should not throw exception when {g,s}etting an undefined property
-* JEXL-78:      Ternary operator throws Exception when JexlEngine in strict mode
-* JEXL-76:      Remove unnecessary class VisitorAdapter
-* JEXL-71:      Parsing errors?
-* JEXL-67:      Potential NPE in util.introspection.MethodKey
-* JEXL-66:      testDottedNames expects map enumeration order
-* JEXL-64:      Inconsistent behavior of dotted names
-* JEXL-62:      NPE in Interpreter
-* JEXL-59:      ClassMap holds a reference to class
-* JEXL-56:      Logging wrongly uses java.util.logging
-* JEXL-50:      Div operator does not do integer division
-* JEXL-49:      Block statements aren't parsed
-* JEXL-48:      NPE during expression evaluation
-* JEXL-45:      Unhandled division by zero
-* JEXL-42:      NullPointerException evaluating an expression
-* JEXL-40:      JEXL fails to find abstract public methods in the base class if overridden by non-public derived types
-* JEXL-32:      BigDecimal values are treated as Long values which results in loss of precision
-* JEXL-30:      ASTAddNode does not add BigDecimal objects correctly
-* JEXL-27:      Cannot assign a value to the property of an object, such as object.prop = value.
-* JEXL-26:      ASTArrayAccess messes up on fallback to JexlContext
-* JEXL-19:      Ternary conditional not supported
-* JEXL-3 :      Static method resolution and changes to context
-
-Other issues fixed (Improvements/New Features):
-===============================================
-
-* JEXL-95:      Enhance JSR-223 implementation
-* JEXL-94:      Allow stateful namespaces (ns:function)
-* JEXL-93:      Add public fields as targets of set/get property
-* JEXL-92:      JexlContext API should be more flexible
-* JEXL-89:      Drop main() and suite() methods from Test cases
-* JEXL-85:      2.0 grammar finishing touches & debugger update
-* JEXL-82:      Change foreach syntax
-* JEXL-77:      Rename last Velocity originated classes
-* JEXL-72:      Remove deprecated classes and methods entirely
-* JEXL-70:      Add main class to allow scripts etc to be tested
-* JEXL-63:      JSR-223 support
-* JEXL-61:      Usage of strong references on Method/Constructor & WeakHashMap usage
-* JEXL-60:      Refactor o.a.c.jexl.util and o.a.c.jexl.util.introspection
-* JEXL-58:      UnifiedJEXL
-* JEXL-57:      Change pom.xml to make it Netbeans Maven2 plugin friendly
-* JEXL-55:      JEXL 2.0 redux, attempting to restart the effort to release 2.0
-* JEXL-54:      Light performance enhancements
-* JEXL-47:      Allow single-line comments with //
-* JEXL-43:      Website overview does not mention method calls and new 2.0 features
-* JEXL-41:      Allow nested ${} evaluation
-* JEXL-35:      Final API requirements
-* JEXL-34:      Remove pre and post resolution of variables via the JexlExprResolver classes.
-* JEXL-33:      Remove unnecessary throws Exception from various classes
-* JEXL-29:      Support non-object-level functions/methods, as size and empty function
-* JEXL-25:      Call method with varargs
-* JEXL-24:      Support Long for integer literal instead of Integers
-* JEXL-21:      operator overloading / hooks on operator processing
-* JEXL-16:      allowing quote escaping
-* JEXL-15:      Needs definable functions
-* JEXL-11:      Don't make null convertible into anything
-* JEXL-10:      Make possible checking for unresolved variables
-
-Other Changes:
-==============
-
-o Add @since 2.0 tags to code so we can track API additions via Javadoc
-
-Upgrading from JEXL 1.x
-=======================
-
-JEXL now requires Java 1.5 or later.
-
-Version 2.0 resides in the org.apache.commons.jexl2 package; part of the version 1.x API is reimplemented as an
-add-on source library in the jexl-compat directory; since it can not fully reimplement the original public 1.x, it may
-only be used to ease transition in strictly controlled deployments.
-
-The following classes are implemented through the jexl-compat source library:
-  * ExpressionFactory
-  * ScriptFactory
-  * Expression
-  * Script
-  * JexlContext
-  * JexlHelper
-
-Migration notes
-===============
-
-When migrating from jexl 1.x to jexl 2.0, the following hints may be helpfull.
-
-The following classes no longer exist:
-  * ExpressionFactory, ScriptFactory: create a JexlEngine and use createExpression() or createScript()
-  instead.
-
-The following classes have been renamed and replaced:
-
-  * VelMethod <=> JexlMethod
-  * VelPropertyGet <=> JexlPropertyGet
-  * VelPropertySet <=> JexlPropertySet
-
-The following methods have been removed:
-
-  * Info.getTemplateName() - use Info.getName() instead
-  * Expression.addPostResolver() / Expression.addPreResolver() - set ant-like variables in JexlContext, implement
-    a specific JexlContext or derive JexlcontextInterpreter/JexlEngine instead
-
-Behavior changes
-================
-
-* Public fields are considered when using JexlPropertyGet / JexlPropertySet: JEXL 1.x behavior can be reimplemented
-by subclassing UberspectImpl.
-
-*Division (/ operator) behavior change: division between integers no longer casts its operands to double; integer division
-    allways results in a integer. The 1.x behavior can be reimplemented by subclassing JexlArithmetic.
-
-New Features:
-=============
-
-Assignment expression: a = b (and a.b.c = d)
-   * Assigns a variable (ant-like variable or bean-property)
-
-Ternary operator expression: a ? b : c  (and a ?: c)
-   * The usual inline conditional shortcut and its 'Elvis' form (a ?: b evaluates as a ? a : b)
-
-Constructor call expression: new('my.class.name', arguments...)
-   * Creates a new instance of a class using the most appropriate constructor according
-     to the actual arguments
-
-Function namespace: ns:func(arguments...)
-   * A function namespace allows the use of class or instance methods in function calls
-
-UnifiedJEXL
-   * Adds ${...} and #{...} JSP/EL syntax support on top of the JexlEngine
-
-JSR-223 support
-   * Implement JSR-223 Scripting Engine for JEXL script (need BSF-3.0 on Java < 6)
-
-Error and exception handling
-   * Configuring the leniency and verbosity of the JEXL engine allows user control over the
-     error handling policy
+New Features
+============
+
+o JEXL-392:  Enable namespace declaration based on scripts.
+o JEXL-391:  Improve in/=~ operator when arguments are arrays and collections.
+o JEXL-390:  Pragmas should not be statements.
+o JEXL-389:  Improve parsing timings.
+o JEXL-385:  Support disabling fortran-style relational operators syntax.
+o JEXL-382:  Simplify grammar and lexical state management.
+o JEXL-380:  Multiple values per pragma key.
+o JEXL-379:  Allow new to use class identifier.
+o JEXL-373:  Add support for prefix/postfix increment/decrement operators.
+o JEXL-372:  Add support for 'standard' for loop.
+o JEXL-369:  Add 'let' and 'const' variable declarations.
+o JEXL-367:  Named function and fat-arrow (=>) lambda syntax.
+o JEXL-366:  Fail to evaluate string and number comparison.
+o JEXL-365:  Lambda expressions.
+o JEXL-363:  Allow retrieving captured variables in script.
+o JEXL-360:  Add missing bitshift operators (>>, >>>, <<).
+o JEXL-359:  Allow per-operator arithmetic handling of null arguments.
+o JEXL-357:  Configure accessible packages/classes/methods/fields.
+
+Bugs Fixed
+==========
+
+o JEXL-386:  Non-inheritable permissions on interfaces are ignored in an inheritable sandbox.
+o JEXL-384:  Improve control over JexlArithmetic null argument handling.
+o JEXL-378:  Incremental operator and decremental operator do not honor the side-effect flag.
+o JEXL-376:  Introspector captures methods on non-exported classes (modules, java9+).
+o JEXL-375:  Cannot access enums by their name when using sandbox.
+o JEXL-374:  No exception if dereferencing null object using safe(false) and antish(false).
+o JEXL-371:  Override of a protected method with public visibility is not callable.
+o JEXL-370:  Cannot check if variable is defined using ObjectContext if the value is null.
+o JEXL-368:  Namespace functor resolution is not cached.
+o JEXL-364:  Evaluator options not propagated in closures.
+o JEXL-362:  JexlInfo position reporting is off.
+o JEXL-361:  Null may be used as operand silently even in arithmetic strict(true) mode.
+o JEXL-354:  #pragma does not handle negative integer or real literals.
+o JEXL-353:  Documentation error for not-in/not-match operator.
diff --git a/pom.xml b/pom.xml
index de349207..bda2c68c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
         <version>102</version>
     </parent>
     <artifactId>commons-jexl3</artifactId>
-    <version>3.6.4-SNAPSHOT</version>
+    <version>3.7.0-SNAPSHOT</version>
     <name>Apache Commons JEXL</name>
     <description>Apache Commons JEXL is a library that enables scripting features in Java applications and frameworks..</description>
     <url>https://commons.apache.org/proper/commons-jexl/</url>
@@ -75,8 +75,8 @@
         <project.build.outputTimestamp>2026-06-23T18:46:16Z</project.build.outputTimestamp>
         <!-- Commons release plugin -->
         <commons.bc.version>3.6.3</commons.bc.version>
-        <commons.release.version>3.6.4</commons.release.version>
-        <commons.release.next>3.6.5</commons.release.next>
+        <commons.release.version>3.7.0</commons.release.version>
+        <commons.release.next>3.7.1</commons.release.next>
         <commons.rc.version>RC1</commons.rc.version>
         <commons.release.isDistModule>true</commons.release.isDistModule>
         <commons.distSvnStagingUrl>scm:svn:https://dist.apache.org/repos/dist/dev/commons/${commons.componentid}</commons.distSvnStagingUrl>
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index fc424597..c2035b3c 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -27,10 +27,13 @@
         <author email="dev@commons.apache.org">Commons Developers</author>
     </properties>
     <body>
-        <release version="3.6.4" date="2026-06-24" description="This is a feature and maintenance release. Java 8 or later is required.">
+        <release version="3.7.0" date="2026-06-27" description="This is a feature and maintenance release. Java 8 or later is required.">
+            <!-- ADD -->
+            <action dev="henrib" type="add" issue="JEXL-465">Add JexlConfigLoader to build a JexlEngine from a YAML configuration (permissions, features, arithmetic, namespaces, imports).</action>
+            <action dev="henrib" type="add" issue="JEXL-464">Default permissions are SECURE and default features harden parse-time behavior (disable new, global side-effects, pragmas and annotations; enable lexical scoping; loops remain available to scripts).</action>
+            <action dev="henrib" type="add" issue="JEXL-463">Add JexlPermissions.logging() to wrap a permission set and log which reflective elements are allowed or denied.</action>
             <!-- FIX -->
             <action dev="henrib" type="fix" issue="JEXL-462">JexlPermissions.RESTRICTED must ensure a better level of isolation.</action>
-            <!-- ADD -->
             <!-- UPDATE -->
         </release>
         <release version="3.6.3" date="2026-06-20"
diff --git a/src/main/java/org/apache/commons/jexl3/JexlBuilder.java b/src/main/java/org/apache/commons/jexl3/JexlBuilder.java
index dd410f6c..c1ca9dc2 100644
--- a/src/main/java/org/apache/commons/jexl3/JexlBuilder.java
+++ b/src/main/java/org/apache/commons/jexl3/JexlBuilder.java
@@ -88,10 +88,39 @@ public class JexlBuilder {
     /**
      * The set of default permissions used when creating a new builder.
      * <p>Static but modifiable, so these default permissions can be changed to a purposeful set.</p>
-     * <p>In JEXL 3.3, these are {@link JexlPermissions#RESTRICTED}.</p>
+     * <p>In JEXL 3.7, these are {@link JexlPermissions#SECURE}.</p>
+     * <p>In JEXL 3.3, these were {@link JexlPermissions#RESTRICTED}.</p>
      * <p>In JEXL 3.2, these were equivalent to {@link JexlPermissions#UNRESTRICTED}.</p>
      */
-    private static JexlPermissions PERMISSIONS = JexlPermissions.RESTRICTED;
+    private static JexlPermissions PERMISSIONS = JexlPermissions.SECURE;
+
+    /**
+     * The full feature set that was the implicit default before JEXL 3.7.
+     * <p>This captures {@link JexlFeatures#createDefault()} - the feature set the engine used as its
+     * fallback throughout 3.x (since 3.3) before the 3.7 hardening. It enables {@code new(...)}, loops,
+     * side-effects, lambdas, method calls, structured literals, pragmas, etc. Use it (or
+     * {@link #setDefaultFeatures(JexlFeatures)}) to restore pre-3.7 behavior:</p>
+     * <pre>
+     * JexlEngine jexl = new JexlBuilder().features(JexlBuilder.FULL).create();
+     * </pre>
+     * <p>{@link JexlFeatures} instances are mutable; copy this one via {@code new JexlFeatures(JexlBuilder.FULL)}
+     * before customizing it rather than mutating the shared instance.</p>
+     *
+     * @since 3.7.0
+     */
+    public static final JexlFeatures FULL = JexlFeatures.createDefault();
+
+    /**
+     * The set of default features used when creating a new builder.
+     * <p>Static but modifiable via {@link #setDefaultFeatures(JexlFeatures)}.</p>
+     * <p>In JEXL 3.7, the default hardens the feature set relative to {@link #FULL}: {@code new(...)},
+     * global side-effects, pragmas, and annotations are disabled, and lexical scoping (with shade) is
+     * enabled.  Loops remain available to scripts (expressions never allow them).  Scripts using a
+     * disabled construct will throw {@link JexlException.Feature} at parse time.</p>
+     *
+     * @see #secureFeatures()
+     */
+    private static JexlFeatures FEATURES = secureFeatures();
 
     /** The default maximum expression length to hit the expression cache. */
     protected static final int CACHE_THRESHOLD = 64;
@@ -102,7 +131,40 @@ public class JexlBuilder {
      * @param permissions the permissions
      */
     public static void setDefaultPermissions(final JexlPermissions permissions) {
-        PERMISSIONS = permissions == null ? JexlPermissions.RESTRICTED : permissions;
+        PERMISSIONS = permissions == null ? JexlPermissions.SECURE : permissions;
+    }
+
+    /**
+     * Sets the default features used when creating a new builder.
+     * <p>Passing {@code null} restores the 3.7 hardened default (new-instance, global side-effects,
+     * pragmas, and annotations disabled, lexical scoping enabled; see {@link #secureFeatures()}).</p>
+     *
+     * @param features the features, or {@code null} to restore the hardened default
+     * @since 3.7.0
+     */
+    public static void setDefaultFeatures(final JexlFeatures features) {
+        FEATURES = features == null ? secureFeatures() : features;
+    }
+
+    /**
+     * Builds the JEXL 3.7 hardened default feature set.
+     * <p>Starting from {@link #FULL} (the pre-3.7 feature set), this disables {@code new(...)},
+     * global side-effects, pragmas, and annotations, and enables lexical scoping and lexical shade.
+     * Loops are left enabled so scripts can iterate; expressions never allow loops since they are
+     * parsed as a single expression.</p>
+     *
+     * @return a fresh hardened feature set
+     * @since 3.7.0
+     */
+    private static JexlFeatures secureFeatures() {
+        return new JexlFeatures(FULL)
+            .newInstance(false)
+            .sideEffectGlobal(false)
+            .pragma(false)
+            .annotation(false)
+            .loops(true)
+            .lexical(true)
+            .lexicalShade(true);
     }
 
     /** The JexlUberspect instance. */
@@ -168,16 +230,19 @@ public class JexlBuilder {
      * </p><p>
      * However, without mitigation, this change will likely break some scripts at runtime, especially those exposing
      * your own class instances through arguments, contexts, or namespaces.
-     * The new default set of allowed packages and denied classes is described by {@link JexlPermissions#RESTRICTED}.
+     * The default set of allowed packages and denied classes is described by {@link JexlPermissions#SECURE}
+     * as of JEXL 3.7 (previously {@link JexlPermissions#RESTRICTED} since 3.3).
      * </p><p>
-     * The recommended mitigation if your usage of JEXL is impacted is to first thoroughly review what should be
-     * allowed and exposed to script authors and implement those through a set of {@link JexlPermissions};
-     * those are easily created using {@link JexlPermissions#parse(String...)}.
+     * As of JEXL 3.7, the default features also disable {@code new(...)}, global side-effects, pragmas,
+     * and annotations, and enable lexical scoping; loops remain available to scripts (but never to
+     * expressions). Scripts using a disabled construct will throw {@link JexlException.Feature} at parse
+     * time unless a permissive feature set is configured.
      * </p><p>
-     * In the urgent case of a strict 3.2 compatibility, the simplest and fastest mitigation is to use the 'unrestricted'
-     * set of permissions. The builder must be explicit about it either by setting the default permissions with a
-     * statement like {@code JexlBuilder.setDefaultPermissions(JexlPermissions.UNRESTRICTED);} or with a more precise
-     * one like {@code new JexlBuilder().permissions({@link JexlPermissions#UNRESTRICTED})}.
+     * The recommended mitigation if your usage of JEXL is impacted is to load a {@code jexl.yaml}
+     * configuration via {@link JexlConfigLoader} that restores the legacy permissions and features,
+     * or to explicitly configure them via {@link #permissions(JexlPermissions)} and
+     * {@link #features(JexlFeatures)}. Use {@link JexlPermissions#logging()} to discover which
+     * reflective elements the new algorithm denies.
      * </p><p>
      * Note that an explicit call to {@link #uberspect(JexlUberspect)} will supersede any permissions related behavior
      * by using the {@link JexlUberspect} provided as argument used as-is in the created {@link JexlEngine}.
@@ -187,6 +252,7 @@ public class JexlBuilder {
      */
     public JexlBuilder() {
         this.permissions = PERMISSIONS;
+        this.features = FEATURES == null ? null : new JexlFeatures(FEATURES);
     }
 
     /**
diff --git a/src/main/java/org/apache/commons/jexl3/JexlConfigLoader.java b/src/main/java/org/apache/commons/jexl3/JexlConfigLoader.java
new file mode 100644
index 00000000..39605cf3
--- /dev/null
+++ b/src/main/java/org/apache/commons/jexl3/JexlConfigLoader.java
@@ -0,0 +1,595 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.jexl3;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.math.MathContext;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.jexl3.introspection.JexlPermissions;
+import org.apache.commons.jexl3.introspection.JexlUberspect;
+
+/**
+ * Loads a YAML configuration file and applies it to a {@link JexlBuilder}.
+ *
+ * <p>Quick start:</p>
+ * <pre>
+ * try (InputStream in = getClass().getResourceAsStream("/jexl.yaml")) {
+ *     JexlEngine engine = JexlConfigLoader.load(in).create();
+ * }
+ * </pre>
+ *
+ * <p>The loader understands a simple YAML subset: top-level scalars, one level of section nesting,
+ * and list items.  No external YAML library is required.  Inline comments ({@code #} after
+ * whitespace), empty lines, and single/double-quoted string values are supported.</p>
+ *
+ * <h2>Top-level scalar keys</h2>
+ * <p>These map directly to the matching {@link JexlBuilder} setter.  Boolean values accept
+ * {@code true/false}, {@code yes/no}, or {@code on/off}.  Example:</p>
+ * <pre>
+ * strict: true         # JexlBuilder.strict(true)
+ * silent: false        # JexlBuilder.silent(false)
+ * safe: true           # JexlBuilder.safe(true)   — enable safe-navigation ?.
+ * cancellable: false   # JexlBuilder.cancellable(false)
+ * antish: true         # JexlBuilder.antish(true) — resolve ant-style dotted names
+ * lexical: true        # JexlBuilder.lexical(true)
+ * lexicalShade: false  # JexlBuilder.lexicalShade(false)
+ * strictInterpolation: false
+ * booleanLogical: false
+ * debug: true          # include source location in exceptions
+ * cache: 512           # expression cache size (entries)
+ * cacheThreshold: 64   # max expression length cached
+ * stackOverflow: 512   # max recursion depth
+ * collectMode: 1       # variable collection mode (0=off, 1=on)
+ * charset: UTF-8       # source charset for script text
+ * strategy: JEXL_STRATEGY   # property-resolver order: JEXL_STRATEGY or MAP_STRATEGY
+ * </pre>
+ *
+ * <h2>{@code permissions:} section</h2>
+ * <p>Controls which classes and members are visible to scripts.</p>
+ * <pre>
+ * permissions:
+ *   base: SECURE           # SECURE (default) | RESTRICTED | UNRESTRICTED
+ *   rules:                 # list of JexlPermissions DSL strings composed on top of base
+ *     - "com.example.api +{}"           # allow whole package
+ *     - "com.example.api +{ Foo{} }"    # allow specific class
+ *     - "java.util +{ -Formatter { Formatter(); } }"  # deny one constructor
+ *   classes:               # explicit fully-qualified class names to allow (ClassPermissions)
+ *     - com.example.api.Foo
+ *     - com.example.api.Bar
+ *   logging: my.logger     # optional: wrap in LoggingPermissions; value = logger name
+ *                          # bare "logging:" with no value uses the default logger
+ * </pre>
+ * <p>See {@link JexlPermissions#parse(String...)} for the DSL syntax,
+ * {@link JexlPermissions#SECURE}, {@link JexlPermissions#RESTRICTED},
+ * {@link JexlPermissions#logging()} for the logging wrapper.</p>
+ *
+ * <h2>{@code features:} section</h2>
+ * <p>Controls which syntactic constructs are available at parse time.  Each key is the name of
+ * a {@link JexlFeatures} boolean setter method; unknown keys are silently ignored.</p>
+ * <pre>
+ * features:
+ *   # Script structure
+ *   script: true             # multi-statement scripts (vs. single-expression mode)
+ *   localVar: true           # local variable declarations (var x = ...)
+ *   lambda: true             # lambda / named-function definitions
+ *   loops: true              # for / while / do-while loops
+ *   newInstance: true        # new(...) constructor calls
+ *
+ *   # Side-effects
+ *   sideEffect: true         # any assignment or modification (=, +=, ...)
+ *   sideEffectGlobal: true   # assignment to context / global variables
+ *
+ *   # Literals and operators
+ *   structuredLiteral: true  # array [], map {}, set {} literals; ranges a..b
+ *   arrayReferenceExpr: true # non-constant array index expressions (x[f()])
+ *   methodCall: true         # method calls on objects (obj.method())
+ *   annotation: true         # @annotation statements
+ *   pragma: true             # #pragma directives
+ *   pragmaAnywhere: true     # allow #pragma anywhere (not just at the top)
+ *   namespacePragma: true    # #pragma jexl.namespace.ns ... syntax
+ *   namespaceIdentifier: true# ns:fun(...) compact namespace call syntax
+ *   importPragma: true       # #pragma jexl.import ... syntax
+ *
+ *   # Lambda arrow styles
+ *   thinArrow: true          # thin-arrow lambdas  x -&gt; x + 1
+ *   fatArrow: true           # fat-arrow lambdas   x =&gt; x + 1
+ *
+ *   # Variable capture semantics
+ *   constCapture: true       # captured variables are read-only (Java-style)
+ *   referenceCapture: false  # captured variables are pass-by-reference (ECMAScript-style)
+ *
+ *   # Lexical scoping (also settable at top level via 'lexical:' / 'lexicalShade:')
+ *   lexical: true
+ *   lexicalShade: false
+ *
+ *   # Misc
+ *   comparatorNames: true    # allow 'gt', 'lt', 'ge', 'le', 'eq', 'ne' as operator aliases
+ *   ambiguousStatement: true # allow statements that are syntactically ambiguous
+ *   ignoreTemplatePrefix: false
+ *
+ *   # Reserved names (list — cannot be used as local variable or parameter names)
+ *   reservedNames:
+ *     - try
+ *     - catch
+ *     - class
+ * </pre>
+ *
+ * <h2>{@code arithmetic:} section</h2>
+ * <p>Selects and configures the {@link JexlArithmetic} implementation.</p>
+ * <pre>
+ * arithmetic:
+ *   clazz: org.apache.commons.jexl3.JexlArithmetic  # fully-qualified class (default)
+ *   strict: true       # strict arithmetic (true = default); passed to the constructor
+ *   mathContext: DECIMAL64   # java.math.MathContext field: DECIMAL32 | DECIMAL64 | DECIMAL128 | UNLIMITED
+ *   mathScale: 10      # BigDecimal scale; requires mathContext; -1 = use context default
+ * </pre>
+ * <p>When {@code mathContext} is present the constructor {@code (boolean, MathContext, int)} is used;
+ * otherwise {@code (boolean)} is used.  The class must be on the classpath.</p>
+ *
+ * <h2>{@code namespaces:} section</h2>
+ * <p>Maps namespace prefixes to fully-qualified class names.  The class is loaded and passed to
+ * {@link JexlBuilder#namespaces(java.util.Map)}.  Its static (or instance) methods become
+ * callable as {@code prefix:methodName(args)} from scripts.</p>
+ * <pre>
+ * namespaces:
+ *   math: java.lang.Math          # math:abs(-1) etc.
+ *   str:  com.example.StringUtils # str:trim(x) etc.
+ * </pre>
+ *
+ * <h2>{@code imports:} section</h2>
+ * <p>A list of package or class names passed to {@link JexlBuilder#imports(java.util.Collection)}.
+ * Imported packages allow unqualified class names in {@code new(...)} and type references.</p>
+ * <pre>
+ * imports:
+ *   - java.lang
+ *   - java.util
+ *   - com.example.api
+ * </pre>
+ *
+ * <h2>Complete annotated example</h2>
+ * <p>Every flag is listed explicitly so the configuration does not depend on any library default
+ * (which may change between releases).  The {@code features:} block below reproduces the pre-3.7
+ * feature set ({@link JexlFeatures#createDefault()}).</p>
+ * <pre>
+ * # Production engine — explicit permissions + legacy feature set
+ * strict: true
+ * safe: false
+ * cache: 512
+ *
+ * permissions:
+ *   base: RESTRICTED
+ *   rules:
+ *     - "com.example.api +{}"
+ *   logging: com.example.jexl.permissions  # log allow/deny at INFO once per element
+ *
+ * features:
+ *   script: true
+ *   localVar: true
+ *   lambda: true
+ *   loops: true
+ *   newInstance: true
+ *   sideEffect: true
+ *   sideEffectGlobal: true
+ *   structuredLiteral: true
+ *   arrayReferenceExpr: true
+ *   methodCall: true
+ *   annotation: true
+ *   pragma: true
+ *   pragmaAnywhere: true
+ *   namespacePragma: true
+ *   importPragma: true
+ *   namespaceIdentifier: false
+ *   thinArrow: true
+ *   fatArrow: false
+ *   constCapture: false
+ *   referenceCapture: false
+ *   lexical: false
+ *   lexicalShade: false
+ *   comparatorNames: true
+ *   ambiguousStatement: false
+ *   ignoreTemplatePrefix: false
+ *
+ * namespaces:
+ *   math: java.lang.Math
+ *
+ * imports:
+ *   - java.lang
+ *   - java.util
+ * </pre>
+ *
+ * @since 3.7.0
+ */
+public final class JexlConfigLoader {
+
+    private JexlConfigLoader() { }
+
+    /**
+     * Loads configuration from a YAML {@link InputStream} (UTF-8) into a {@link JexlBuilder}.
+     *
+     * @param in YAML input; the caller is responsible for closing it
+     * @return a configured JexlBuilder
+     * @throws IOException if the stream cannot be read
+     */
+    public static JexlBuilder load(final InputStream in) throws IOException {
+        return load(new InputStreamReader(in, StandardCharsets.UTF_8));
+    }
+
+    /**
+     * Loads configuration from a YAML {@link Reader} into a {@link JexlBuilder}.
+     *
+     * @param reader YAML input; the caller is responsible for closing it
+     * @return a configured JexlBuilder
+     * @throws IOException if the reader cannot be read
+     */
+    public static JexlBuilder load(final Reader reader) throws IOException {
+        final JexlBuilder builder = new JexlBuilder();
+        final JexlFeatures features = new JexlFeatures();
+        parse(reader instanceof BufferedReader ? (BufferedReader) reader
+            : new BufferedReader(reader), builder, features);
+        return builder.features(features);
+    }
+
+    /**
+     * Convenience: loads YAML from {@code in} and creates the engine in one call.
+     *
+     * @param in YAML input; the caller is responsible for closing it
+     * @return a new JexlEngine configured from the YAML
+     * @throws IOException if the stream cannot be read
+     */
+    public static JexlEngine engine(final InputStream in) throws IOException {
+        return load(in).create();
+    }
+
+    // =========================================================================
+    //  Parser
+    // =========================================================================
+
+    /**
+     * Minimal line-by-line YAML parser that handles the subset needed for JEXL configuration:
+     * top-level key:value scalars, one-level section blocks, and list items within sections.
+     */
+    private static void parse(final BufferedReader reader,
+                              final JexlBuilder builder,
+                              final JexlFeatures features) throws IOException {
+        String section = null;
+        Map<String, Object> sectionData = null;
+        List<String> currentList = null;
+        String currentListKey = null;
+
+        for (String raw; (raw = reader.readLine()) != null; ) {
+            final int indent = leadingSpaces(raw);
+            final String stripped = ltrim(raw);
+            if (stripped.isEmpty() || stripped.charAt(0) == '#') {
+                continue;
+            }
+            final String line = stripComment(stripped);
+            if (line.isEmpty()) {
+                continue;
+            }
+
+            if (indent == 0) {
+                // back to top level — flush any open section
+                if (section != null) {
+                    if (currentList != null && currentListKey != null) {
+                        sectionData.put(currentListKey, currentList);
+                    }
+                    flushSection(section, sectionData, builder, features);
+                    section = null;
+                    sectionData = null;
+                    currentList = null;
+                    currentListKey = null;
+                }
+
+                final int colon = line.indexOf(':');
+                final String key = colon < 0 ? line : rtrim(line.substring(0, colon));
+                final String val = colon < 0 ? "" : ltrim(line.substring(colon + 1));
+
+                if (val.isEmpty()) {
+                    section = key;
+                    sectionData = new LinkedHashMap<>();
+                } else {
+                    applyTopLevel(key, val, builder);
+                }
+
+            } else {
+                // inside a section
+                if (section == null) {
+                    continue;
+                }
+
+                if (line.charAt(0) == '-') {
+                    // list item
+                    final String item = unquote(ltrim(line.substring(1)));
+                    if (currentList == null) {
+                        currentList = new ArrayList<>();
+                        currentListKey = section;
+                    }
+                    currentList.add(item);
+                } else {
+                    final int colon = line.indexOf(':');
+                    final String key = colon < 0 ? line : rtrim(line.substring(0, colon));
+                    final String val = colon < 0 ? "" : ltrim(line.substring(colon + 1));
+
+                    if (val.isEmpty()) {
+                        // nested list-key start (e.g. "rules:")
+                        if (currentList != null && currentListKey != null) {
+                            sectionData.put(currentListKey, currentList);
+                        }
+                        currentListKey = key;
+                        currentList = new ArrayList<>();
+                    } else {
+                        // scalar within section — close any pending list first
+                        if (currentList != null && currentListKey != null) {
+                            sectionData.put(currentListKey, currentList);
+                            currentList = null;
+                            currentListKey = null;
+                        }
+                        sectionData.put(key, val);
+                    }
+                }
+            }
+        }
+
+        // flush the last section
+        if (section != null) {
+            if (currentList != null && currentListKey != null) {
+                sectionData.put(currentListKey, currentList);
+            }
+            flushSection(section, sectionData, builder, features);
+        }
+    }
+
+    // =========================================================================
+    //  Section dispatchers
+    // =========================================================================
+
+    @SuppressWarnings("unchecked")
+    private static void flushSection(final String section,
+                                     final Map<String, Object> data,
+                                     final JexlBuilder builder,
+                                     final JexlFeatures features) {
+        switch (section) {
+            case "permissions":
+                applyPermissions(data, builder);
+                break;
+            case "namespaces":
+                applyNamespaces(data, builder);
+                break;
+            case "arithmetic":
+                applyArithmetic(data, builder);
+                break;
+            case "features":
+                applyFeatures(data, features);
+                break;
+            case "imports": {
+                final Object list = data.get(section);
+                if (list instanceof List) {
+                    builder.imports((List<String>) list);
+                }
+                break;
+            }
+            default:
+                break;
+        }
+    }
+
+    private static void applyTopLevel(final String key,
+                                      final String value,
+                                      final JexlBuilder builder) {
+        switch (key) {
+            case "strict":              builder.strict(parseBool(value)); break;
+            case "silent":              builder.silent(parseBool(value)); break;
+            case "safe":                builder.safe(parseBool(value)); break;
+            case "cancellable":         builder.cancellable(parseBool(value)); break;
+            case "antish":              builder.antish(parseBool(value)); break;
+            case "lexical":             builder.lexical(parseBool(value)); break;
+            case "lexicalShade":        builder.lexicalShade(parseBool(value)); break;
+            case "strictInterpolation": builder.strictInterpolation(parseBool(value)); break;
+            case "booleanLogical":      builder.booleanLogical(parseBool(value)); break;
+            case "debug":               builder.debug(parseBool(value)); break;
+            case "cache":               builder.cache(parseInt(value)); break;
+            case "cacheThreshold":      builder.cacheThreshold(parseInt(value)); break;
+            case "stackOverflow":       builder.stackOverflow(parseInt(value)); break;
+            case "collectMode":         builder.collectMode(parseInt(value)); break;
+            case "charset":             builder.charset(Charset.forName(value)); break;
+            case "strategy":            builder.strategy(parseStrategy(value)); break;
+            default:
+                break;
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    private static void applyPermissions(final Map<String, Object> data,
+                                         final JexlBuilder builder) {
+        final Object baseVal = data.get("base");
+        JexlPermissions perms = "UNRESTRICTED".equals(baseVal) ? JexlPermissions.UNRESTRICTED
+            : "SECURE".equals(baseVal) ? JexlPermissions.SECURE
+            : "RESTRICTED".equals(baseVal) ? JexlPermissions.RESTRICTED
+            : JexlPermissions.SECURE;
+        final Object rules = data.get("rules");
+        if (rules instanceof List && !((List<?>) rules).isEmpty()) {
+            final List<String> ruleList = (List<String>) rules;
+            perms = perms.compose(ruleList.toArray(new String[0]));
+        }
+        final Object classes = data.get("classes");
+        if (classes instanceof List && !((List<?>) classes).isEmpty()) {
+            perms = new JexlPermissions.ClassPermissions(perms, (List<String>) classes);
+        }
+        // optional logging wrapper, outermost so it reports the effective decisions;
+        // a String value names the logger, a bare "logging:" uses the default logger
+        final Object logging = data.get("logging");
+        if (logging != null) {
+            final String name = logging instanceof String ? (String) logging : "";
+            perms = name.isEmpty() ? perms.logging() : perms.logging(name);
+        }
+        builder.permissions(perms);
+    }
+
+    private static void applyNamespaces(final Map<String, Object> data,
+                                        final JexlBuilder builder) {
+        final Map<String, Object> ns = new LinkedHashMap<>(data.size());
+        for (final Map.Entry<String, Object> e : data.entrySet()) {
+            if (e.getValue() instanceof String) {
+                try {
+                    ns.put(e.getKey(), Class.forName((String) e.getValue()));
+                } catch (final ClassNotFoundException ex) {
+                    throw new IllegalArgumentException(
+                        "namespace class not found: " + e.getValue(), ex);
+                }
+            }
+        }
+        if (!ns.isEmpty()) {
+            builder.namespaces(ns);
+        }
+    }
+
+    private static void applyArithmetic(final Map<String, Object> data,
+                                        final JexlBuilder builder) {
+        final String className = data.containsKey("clazz")
+            ? (String) data.get("clazz")
+            : JexlArithmetic.class.getName();
+        final boolean astrict = !data.containsKey("strict") || parseBool((String) data.get("strict"));
+        final Class<?> clazz;
+        try {
+            clazz = Class.forName(className);
+        } catch (final ClassNotFoundException e) {
+            throw new IllegalArgumentException("arithmetic class not found: " + className, e);
+        }
+        try {
+            if (data.containsKey("mathContext")) {
+                final MathContext mc = (MathContext)
+                    MathContext.class.getField((String) data.get("mathContext")).get(null);
+                final int scale = data.containsKey("mathScale")
+                    ? parseInt((String) data.get("mathScale"))
+                    : -1;
+                builder.arithmetic((JexlArithmetic) clazz
+                    .getConstructor(boolean.class, MathContext.class, int.class)
+                    .newInstance(astrict, mc, scale));
+            } else {
+                builder.arithmetic((JexlArithmetic) clazz
+                    .getConstructor(boolean.class)
+                    .newInstance(astrict));
+            }
+        } catch (final ReflectiveOperationException e) {
+            throw new IllegalArgumentException(
+                "cannot instantiate arithmetic class " + className, e);
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    private static void applyFeatures(final Map<String, Object> data,
+                                      final JexlFeatures features) {
+        for (final Map.Entry<String, Object> e : data.entrySet()) {
+            final String key = e.getKey();
+            final Object val = e.getValue();
+            if ("reservedNames".equals(key) && val instanceof List) {
+                features.reservedNames((List<String>) val);
+            } else if (val instanceof String) {
+                try {
+                    final Method m = JexlFeatures.class.getMethod(key, boolean.class);
+                    m.invoke(features, parseBool((String) val));
+                } catch (final NoSuchMethodException ignored) {
+                    // unknown feature key — skip
+                } catch (final IllegalAccessException | InvocationTargetException ex) {
+                    throw new IllegalArgumentException("cannot set feature " + key, ex);
+                }
+            }
+        }
+    }
+
+    // =========================================================================
+    //  Parsing helpers
+    // =========================================================================
+
+    private static JexlUberspect.ResolverStrategy parseStrategy(final String name) {
+        return "MAP_STRATEGY".equals(name)
+            ? JexlUberspect.MAP_STRATEGY
+            : JexlUberspect.JEXL_STRATEGY;
+    }
+
+    private static boolean parseBool(final String s) {
+        return "true".equalsIgnoreCase(s) || "yes".equalsIgnoreCase(s) || "on".equalsIgnoreCase(s);
+    }
+
+    private static int parseInt(final String s) {
+        return Integer.parseInt(s.trim());
+    }
+
+    private static int leadingSpaces(final String s) {
+        int i = 0;
+        while (i < s.length() && (s.charAt(i) == ' ' || s.charAt(i) == '\t')) {
+            i++;
+        }
+        return i;
+    }
+
+    private static String ltrim(final String s) {
+        int i = 0;
+        while (i < s.length() && Character.isWhitespace(s.charAt(i))) {
+            i++;
+        }
+        return i == 0 ? s : s.substring(i);
+    }
+
+    private static String rtrim(final String s) {
+        int i = s.length();
+        while (i > 0 && Character.isWhitespace(s.charAt(i - 1))) {
+            i--;
+        }
+        return i == s.length() ? s : s.substring(0, i);
+    }
+
+    private static String stripComment(final String s) {
+        boolean inDouble = false;
+        boolean inSingle = false;
+        for (int i = 0; i < s.length(); i++) {
+            final char c = s.charAt(i);
+            if (c == '"' && !inSingle) {
+                inDouble = !inDouble;
+            } else if (c == '\'' && !inDouble) {
+                inSingle = !inSingle;
+            } else if (c == '#' && !inDouble && !inSingle
+                && i > 0 && Character.isWhitespace(s.charAt(i - 1))) {
+                return rtrim(s.substring(0, i));
+            }
+        }
+        return s;
+    }
+
+    private static String unquote(final String s) {
+        if (s.length() >= 2) {
+            final char first = s.charAt(0);
+            final char last = s.charAt(s.length() - 1);
+            if ((first == '"' && last == '"') || (first == '\'' && last == '\'')) {
+                return s.substring(1, s.length() - 1);
+            }
+        }
+        return s;
+    }
+}
diff --git a/src/main/java/org/apache/commons/jexl3/internal/introspection/Permissions.java b/src/main/java/org/apache/commons/jexl3/internal/introspection/Permissions.java
index 47ab2b8e..e58beaf1 100644
--- a/src/main/java/org/apache/commons/jexl3/internal/introspection/Permissions.java
+++ b/src/main/java/org/apache/commons/jexl3/internal/introspection/Permissions.java
@@ -114,6 +114,16 @@ public class Permissions implements JexlPermissions {
         }
 
         boolean isEmpty() { return methodNames.isEmpty() && fieldNames.isEmpty(); }
+
+        /**
+         * Whether this is a positive (allow-oriented) class declaration.
+         * <p>A positive class is explicitly allowed in its package (it contributes to
+         * {@link NoJexlPackage#hasAllowedClass()} and an empty one means &quot;allow the whole class&quot;).
+         * A plain deny-list {@code NoJexlClass} is not positive.</p>
+         *
+         * @return true if the class is positively allowed, false if it is a deny-list
+         */
+        boolean isPositive() { return false; }
     }
 
     /**
@@ -133,6 +143,27 @@ public class Permissions implements JexlPermissions {
         @Override boolean deny(final Constructor<?> method) { return !super.deny(method); }
         @Override boolean deny(final Field field) { return !super.deny(field); }
         @Override boolean deny(final Method method) { return !super.deny(method); }
+        @Override boolean isPositive() { return true; }
+    }
+
+    /**
+     * A class that is positively allowed in its package yet carries deny-list member semantics.
+     * <p>Used for {@code +ClassName{ -member(); }} inside a deny package: the class is added to the
+     * allowed set (so unlisted classes in the package stay denied) but the named members are denied
+     * while all others remain allowed. It is a {@link NoJexlClass} (deny-list) tagged as positive;
+     * the deny-list behavior is inherited unchanged.</p>
+     */
+    static class AllowedNoJexlClass extends NoJexlClass {
+        AllowedNoJexlClass() {
+            super();
+        }
+        AllowedNoJexlClass(final Set<String> methods, final Set<String> fields) {
+            super(methods, fields);
+        }
+        @Override public AllowedNoJexlClass copy() {
+            return new AllowedNoJexlClass(new HashSet<>(methodNames), new HashSet<>(fieldNames));
+        }
+        @Override boolean isPositive() { return true; }
     }
 
     /**
@@ -173,7 +204,7 @@ public class Permissions implements JexlPermissions {
         boolean isEmpty() { return nojexl.isEmpty(); }
 
         /**
-         * Whether this package has at least one explicitly-allowed class (a {@code JexlClass} entry).
+         * Whether this package has at least one explicitly-allowed class (a positive entry).
          * <p>A package with allowed-class entries acts as an allow-list: unlisted classes are denied.
          * A package with only denied-class entries acts as a deny-list: unlisted classes are allowed.</p>
          *
@@ -181,13 +212,21 @@ public class Permissions implements JexlPermissions {
          */
         boolean hasAllowedClass() {
             for (final NoJexlClass njc : nojexl.values()) {
-                if (njc instanceof JexlClass) {
+                if (njc.isPositive()) {
                     return true;
                 }
             }
             return false;
         }
 
+        /**
+         * Whether this is a positive (allow-oriented) package declaration.
+         * <p>A positive package allows its own classes by default; a deny-list package does not.</p>
+         *
+         * @return true if the package is positively allowed, false otherwise
+         */
+        boolean isPositive() { return false; }
+
         @Override public NoJexlPackage copy() {
             return new NoJexlPackage(copyMap(nojexl));
         }
@@ -207,6 +246,8 @@ public class Permissions implements JexlPermissions {
             return njc != null ? njc : JEXL_CLASS;
         }
 
+        @Override boolean isPositive() { return true; }
+
         @Override public JexlPackage copy() {
             return new JexlPackage(copyMap(nojexl));
         }
@@ -254,6 +295,13 @@ public class Permissions implements JexlPermissions {
         @Override NoJexlClass getNoJexl(final Class<?> clazz) {
             return JEXL_CLASS;
         }
+        @Override boolean isPositive() {
+            return true;
+        }
+        // a constant singleton survives copy as itself, preserving its positive nature through compose()
+        @Override public NoJexlPackage copy() {
+            return this;
+        }
     };
 
     /**
@@ -394,17 +442,12 @@ public class Permissions implements JexlPermissions {
         if (allowed.isEmpty() && packages.isEmpty()) {
             return true;
         }
-        return !allowed.isEmpty() && wildcardAllow(allowed, packageName);
-    }
-
-    /**
-     * Whether the wildcard set of packages allows a given class to be introspected.
-     *
-     * @param clazz the package name (not null)
-     * @return true if allowed, false otherwise
-     */
-    private boolean wildcardAllow(final Class<?> clazz) {
-        return allowedPackage(ClassTool.getPackageName(clazz));
+        if (!allowed.isEmpty() && wildcardAllow(allowed, packageName)) {
+            return true;
+        }
+        // a package explicitly declared positive allows itself (exact match only, no sub-package inference)
+        final NoJexlPackage njp = packages.get(packageName);
+        return njp != null && njp.isPositive();
     }
 
     /**
@@ -455,24 +498,30 @@ public class Permissions implements JexlPermissions {
         if (Proxy.isProxyClass(clazz)) {
             return true;
         }
-        // class must be allowed
+        // class must not be denied, nor extend a denied class
         if (deny(clazz)) {
             return false;
         }
-        // no super class can be denied and at least one must be allowed
-        boolean explicit = specifiedAllow(clazz, clazz, (njc, c) -> njc instanceof JexlClass);
-        Class<?> walk = clazz.getSuperclass();
-        while (walk != null) {
+        // a subclass of a denied class is also denied; Object (the universal root) is skipped, and the
+        // null guard keeps the walk safe when clazz is an interface or Object itself (getSuperclass() null).
+        for (Class<?> walk = clazz.getSuperclass(); walk != null && walk != Object.class; walk = walk.getSuperclass()) {
             if (deny(walk)) {
                 return false;
             }
-            if (!explicit) {
-                explicit = wildcardAllow(walk);
-            }
-            walk = walk.getSuperclass();
         }
-        // check wildcards
-        return explicit;
+        // a class is allowed only by its own package or class-level declaration: there is deliberately no
+        // reach-through via an allowed super-type, which would otherwise expose the whole foreign class.
+        return allowedClass(clazz);
+    }
+
+    /**
+     * Whether a class is allowed by its own package or class-level declaration.
+     *
+     * @param clazz the class to check (not null)
+     * @return true if explicitly allowed
+     */
+    private boolean allowedClass(final Class<?> clazz) {
+        return specifiedAllow(clazz, clazz, (njc, c) -> njc.isPositive() || !njc.isEmpty());
     }
 
     /**
diff --git a/src/main/java/org/apache/commons/jexl3/internal/introspection/PermissionsParser.java b/src/main/java/org/apache/commons/jexl3/internal/introspection/PermissionsParser.java
index 629d0a0b..1008a0cf 100644
--- a/src/main/java/org/apache/commons/jexl3/internal/introspection/PermissionsParser.java
+++ b/src/main/java/org/apache/commons/jexl3/internal/introspection/PermissionsParser.java
@@ -135,6 +135,8 @@ public class PermissionsParser {
         String njname = null;
         String identifier = inner;
         boolean deny = nojexl;
+        boolean classPositive = false; // the class's own polarity (set at creation, never mutated)
+        boolean memberNegative = false; // whether the pending member is prefixed with '-'
         int i = offset;
         int j = -1;
         boolean isMethod = false;
@@ -164,6 +166,8 @@ public class PermissionsParser {
             if (identifier == null) {
                 // negative or positive set ?
                 if (c == '-') {
+                    // a '-' before a member denies it; tracked for a possible deny-list upgrade
+                    memberNegative = true;
                     i += 1;
                 } else if (c == '+') {
                     deny = false;
@@ -185,6 +189,8 @@ public class PermissionsParser {
                 }
                 // if we have a class, it has a name
                 njclass = deny ? new Permissions.NoJexlClass() : new Permissions.JexlClass();
+                classPositive = !deny;
+                memberNegative = false; // a class-level sign does not carry to members
                 njname = outer != null ? outer + "$" + identifier : identifier;
                 njpackage.addNoJexl(njname, njclass);
                 identifier = null;
@@ -194,9 +200,17 @@ public class PermissionsParser {
                     // inner class
                     i = readClass(njpackage, deny, njname, identifier, i - 1);
                     identifier = null;
+                    memberNegative = false; // an inner-class sign does not change the outer class
                     continue;
                 }
                 if (c == ';') {
+                    // a '-' before a member of a positive class turns it into an allowed deny-list class
+                    if (memberNegative && classPositive && !(njclass instanceof Permissions.AllowedNoJexlClass)) {
+                        final Permissions.AllowedNoJexlClass anc =
+                            new Permissions.AllowedNoJexlClass(njclass.methodNames, njclass.fieldNames);
+                        njpackage.addNoJexl(njname, anc);
+                        njclass = anc;
+                    }
                     // field or method?
                     if (isMethod) {
                         njclass.methodNames.add(identifier);
@@ -205,6 +219,7 @@ public class PermissionsParser {
                         njclass.fieldNames.add(identifier);
                     }
                     identifier = null;
+                    memberNegative = false;
                 } else if (c == '(' && !isMethod) {
                     // method; only one opening parenthesis allowed
                     isMethod = true;
@@ -219,7 +234,7 @@ public class PermissionsParser {
         if (njname != null) {
             if (njclass.isEmpty()) {
                 njpackage.addNoJexl(njname,
-                    njclass instanceof Permissions.JexlClass
+                    njclass.isPositive()
                         ? Permissions.JEXL_CLASS
                         : Permissions.NOJEXL_CLASS);
             } else {
@@ -376,18 +391,12 @@ public class PermissionsParser {
                     i += 1;
                 }
             } else if (c == '}') {
-                // empty means the whole package
+                // empty means the whole package; a positive package is recognized by its JexlPackage/JEXL_PACKAGE
+                // type in the map (it allows itself and anchors reach-through), so nothing is added to wildcards.
                 if (njpackage.isEmpty()) {
                     packages.put(pname, negative == null || negative
                         ? Permissions.NOJEXL_PACKAGE
                         : Permissions.JEXL_PACKAGE);
-                    // a wholly-allowed package (pkg +{}) joins the allowed perimeter as an exact match (no '.*').
-                    // This lets a closed set of packages be declared without wildcards - so future sub-packages are
-                    // never implicitly allowed - while still allowing types based on this package (e.g. a foreign
-                    // Map implementation extending java.util.AbstractMap) the same way a '.*' wildcard would.
-                    if (Boolean.FALSE.equals(negative)) {
-                        wildcards.add(pname);
-                    }
                 } else {
                     packages.put(pname, njpackage);
                 }
diff --git a/src/main/java/org/apache/commons/jexl3/internal/introspection/Uberspect.java b/src/main/java/org/apache/commons/jexl3/internal/introspection/Uberspect.java
index d8d2dbf0..1cdb63e5 100644
--- a/src/main/java/org/apache/commons/jexl3/internal/introspection/Uberspect.java
+++ b/src/main/java/org/apache/commons/jexl3/internal/introspection/Uberspect.java
@@ -33,6 +33,8 @@ import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.commons.jexl3.JexlArithmetic;
 import org.apache.commons.jexl3.JexlEngine;
 import org.apache.commons.jexl3.JexlOperator;
+import org.apache.commons.jexl3.internal.IntegerRange;
+import org.apache.commons.jexl3.internal.LongRange;
 import org.apache.commons.jexl3.internal.Operator;
 import org.apache.commons.jexl3.introspection.JexlMethod;
 import org.apache.commons.jexl3.introspection.JexlPermissions;
@@ -234,7 +236,10 @@ public class Uberspect implements JexlUberspect {
     @Override
     @SuppressWarnings("unchecked")
     public Iterator<?> getIterator(final Object obj) {
-        if (!permissions.allow(obj.getClass())) {
+        // JEXL's own range types and plain arrays are safe language primitives that expose only primitive
+        // values; like arithmetic operators they iterate regardless of permissions.
+        if (!(obj instanceof IntegerRange) && !(obj instanceof LongRange)
+                && !obj.getClass().isArray() && !permissions.allow(obj.getClass())) {
             return null;
         }
         if (obj instanceof Iterator<?>) {
diff --git a/src/main/java/org/apache/commons/jexl3/introspection/JexlPermissions.java b/src/main/java/org/apache/commons/jexl3/introspection/JexlPermissions.java
index b204de6d..bc5609b2 100644
--- a/src/main/java/org/apache/commons/jexl3/introspection/JexlPermissions.java
+++ b/src/main/java/org/apache/commons/jexl3/introspection/JexlPermissions.java
@@ -25,9 +25,12 @@ import java.util.Collection;
 import java.util.HashSet;
 import java.util.Objects;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
 
 import org.apache.commons.jexl3.internal.introspection.PermissionsParser;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * This interface describes permissions used by JEXL introspection that constrain which
@@ -256,6 +259,119 @@ public interface JexlPermissions {
         }
     }
 
+    /**
+     * A permission delegate that logs every allow/deny decision.
+     * <p>This is a debugging aid to determine which reflective elements (classes, constructors, methods, fields)
+     * a permission set allows or denies; wrap any permissions with {@link JexlPermissions#logging()} (or
+     * {@link JexlPermissions#logging(String)} to pick the logger name) and inspect the log to diagnose why a
+     * given object is or is not reachable from scripts.</p>
+     *
+     * @since 3.7.0
+     */
+    class LoggingPermissions extends Delegate {
+        /** The logger that decisions are written to (at info level). */
+        private final Log logger;
+        /** The set of already-emitted log lines, so each decision is logged only once. */
+        private final Set<String> logged = ConcurrentHashMap.newKeySet();
+
+        /**
+         * Constructs an instance logging to a logger named after this class.
+         *
+         * @param delegate the permissions to delegate to
+         */
+        public LoggingPermissions(final JexlPermissions delegate) {
+            this(LogFactory.getLog(LoggingPermissions.class), delegate);
+        }
+
+        /**
+         * Constructs an instance logging to a named logger.
+         *
+         * @param loggerName the name of the logger to use
+         * @param delegate the permissions to delegate to
+         */
+        public LoggingPermissions(final String loggerName, final JexlPermissions delegate) {
+            this(LogFactory.getLog(loggerName), delegate);
+        }
+
+        /**
+         * Constructs an instance with an explicit logger.
+         *
+         * @param log the logger
+         * @param delegate the permissions to delegate to
+         */
+        protected LoggingPermissions(final Log log, final JexlPermissions delegate) {
+            super(delegate);
+            this.logger = log;
+        }
+
+        /**
+         * Logs a decision once: the first time a given message is seen, it is written to the logger;
+         * subsequent identical messages are suppressed.
+         *
+         * @param allowed the decision to return
+         * @param message the message to log
+         * @return the decision
+         */
+        private boolean log(final boolean allowed, final String message) {
+            if (logged.add(message)) {
+                logger.info(message);
+            }
+            return allowed;
+        }
+
+        @Override
+        public boolean allow(final Class<?> clazz) {
+            final boolean allowed = super.allow(clazz);
+            return log(allowed, String.format("Class %s is %s",
+                clazz.getCanonicalName(), allowed ? "allowed" : "denied"));
+        }
+
+        @Override
+        public boolean allow(final Constructor<?> ctor) {
+            final boolean allowed = super.allow(ctor);
+            return log(allowed, String.format("Constructor %s.%s() is %s",
+                ctor.getDeclaringClass().getCanonicalName(), ctor.getName(),
+                allowed ? "allowed" : "denied"));
+        }
+
+        @Override
+        public boolean allow(final Field field) {
+            final boolean allowed = super.allow(field);
+            return log(allowed, String.format("Field %s.%s is %s",
+                field.getDeclaringClass().getCanonicalName(), field.getName(),
+                allowed ? "allowed" : "denied"));
+        }
+
+        @Override
+        public boolean allow(final Class<?> clazz, final Field field) {
+            final boolean allowed = super.allow(clazz, field);
+            return log(allowed, String.format("Field %s.%s is %s for class %s",
+                field.getDeclaringClass().getCanonicalName(), field.getName(),
+                allowed ? "allowed" : "denied", clazz.getCanonicalName()));
+        }
+
+        @Override
+        public boolean allow(final Method method) {
+            final boolean allowed = super.allow(method);
+            return log(allowed, String.format("Method %s.%s() is %s",
+                method.getDeclaringClass().getCanonicalName(), method.getName(),
+                allowed ? "allowed" : "denied"));
+        }
+
+        @Override
+        public boolean allow(final Class<?> clazz, final Method method) {
+            final boolean allowed = super.allow(clazz, method);
+            return log(allowed, String.format("Method %s.%s() is %s for class %s",
+                method.getDeclaringClass().getCanonicalName(), method.getName(),
+                allowed ? "allowed" : "denied", clazz.getCanonicalName()));
+        }
+
+        @Override
+        public JexlPermissions compose(final String... src) {
+            return new LoggingPermissions(logger, base.compose(src));
+        }
+    }
+
     /**
      * The unrestricted permissions.
      * <p>This enables any public class, method, constructor or field to be visible to JEXL and used in scripts.</p>
@@ -267,6 +383,14 @@ public interface JexlPermissions {
     /**
      * A restricted singleton.
      * <p>The RESTRICTED set is built using the following allowed packages and denied packages/classes.</p>
+     * <p>
+     * RESTRICTED attempts to strike a balance between reasonable out-of-the-box isolation and allowing most
+     * legitimate features; it is convenient when scripts need a broad slice of the JDK. In a mission-critical
+     * scenario, prefer {@link #SECURE} as a base instead and {@link #compose(String...) compose} only what your
+     * scripts actually need on top of it. Be aware that the isolation RESTRICTED provides may be incomplete and
+     * could expose more than intended; should such a case be identified, we will endeavour to resolve it in a
+     * subsequent release. Use {@link #logging()} to audit exactly which elements your workload reaches.
+     * </p>
      * <p>Of particular importance are the restrictions on the {@link System},
      * {@link Runtime}, {@link ProcessBuilder}, {@link Class} and those on {@link java.net},
      * {@link java.io} and {@link java.lang.reflect} that should provide a decent level of isolation between the scripts
@@ -303,6 +427,11 @@ public interface JexlPermissions {
      * {@code java.util.zip}, {@code java.util.jar}, {@code java.util.prefs}, {@code java.util.logging},
      * {@code java.util.concurrent.locks}, {@code java.nio.file}, {@code java.lang.reflect},
      * {@code java.lang.invoke} and {@code org.w3c.dom.ls}.</p>
+     * <p>A class is visible only when its <em>own</em> package or class declaration permits it; it is never made
+     * visible merely because one of its super-types is allowed. Consequently a foreign implementation of an allowed
+     * type (for instance a {@code java.util.Map} provided by another library) is not visible unless its own package
+     * is explicitly allowed, e.g. {@code RESTRICTED.compose("com.example.foreign +{}")}. Use {@link #logging()} to
+     * diagnose which elements are allowed or denied.</p>
      */
 
     JexlPermissions RESTRICTED = JexlPermissions.parse(
@@ -314,7 +443,7 @@ public interface JexlPermissions {
         "java.time.format +{}",
         "java.time.temporal +{}",
         "java.time.zone +{ -ZoneRulesProvider{} }",
-        "java.util +{}",
+        "java.util +{ -Formatter { Formatter(); } }",
         "java.util.concurrent +{" +
             "-Executors{} -ExecutorService{} -AbstractExecutorService{}" +
             "-ThreadPoolExecutor{} -ScheduledThreadPoolExecutor{} -ScheduledExecutorService{}" +
@@ -330,10 +459,44 @@ public interface JexlPermissions {
             "-RuntimePermission{} -SecurityManager{}" +
             "-Thread{} -ThreadGroup{} -Class{} -ClassLoader{}" +
             "}",
-        "java.io -{ +PrintWriter{} +Writer{} +StringWriter{} +Reader{} +InputStream{} +OutputStream{} }",
+        "java.io -{ +PrintWriter{ -PrintWriter(); } +Writer{} +StringWriter{} +Reader{} +InputStream{} +OutputStream{} }",
         "java.nio +{}",
         "java.nio.charset +{}",
-        "org.apache.commons.jexl3 +{ -JexlBuilder{} }"
+        "org.apache.commons.jexl3 +{ -JexlBuilder{} -JexlConfigLoader{} }"
+    );
+
+    /**
+     * An absolute-minimum, allow-list-first permission set.
+     * <p>This is the tightest sensible baseline: nothing is reachable unless explicitly whitelisted here.
+     * It exposes only the safe {@code java.lang} value types, {@code java.math} big numbers and the
+     * {@code java.util} collection types - enough for arithmetic, string and collection scripting.</p>
+     * <p>Allowed:</p>
+     * <ul>
+     * <li>{@code java.lang}: {@code Object} (minus {@code getClass}/{@code wait}/{@code notify}/{@code notifyAll}),
+     * {@code Number} and the boxed primitives, {@code String}, {@code CharSequence}, {@code StringBuilder},
+     * {@code Math}, {@code Comparable}, {@code Iterable}; everything else in {@code java.lang}
+     * (e.g. {@code System}, {@code Runtime}, {@code Thread}, {@code Class}, {@code ClassLoader}) is denied.</li>
+     * <li>{@code java.math} (for {@code BigInteger}/{@code BigDecimal}, i.e. the {@code 1B}/{@code 1H} literals).</li>
+     * <li>{@code java.util} - the collection types produced by list/map/set literals. Because a positive package
+     * does not cover sub-packages, {@code java.util.zip}/{@code concurrent}/{@code jar}/… stay denied.</li>
+     * </ul>
+     * <p>Arithmetic, comparisons and string concatenation require no permission at all (they are handled by
+     * {@link org.apache.commons.jexl3.JexlArithmetic}); ranges ({@code 1..n}) iterate as a language primitive.
+     * Compose more in with {@link #compose(String...)} (e.g. {@code SECURE.compose("java.time +{}")}), and use
+     * {@link #logging()} to discover what a script is denied. Note {@code java.util} still includes
+     * {@code Random}, {@code Scanner} and {@code ServiceLoader}; tighten with an explicit class list if needed.</p>
+     *
+     * @since 3.7.0
+     */
+    JexlPermissions SECURE = JexlPermissions.parse(
+        "# Absolute-minimum permissions: safe java.lang value types + java.math + java.util collections",
+        "java.lang -{"
+            + " +Object{ -getClass(); -wait(); -notify(); -notifyAll(); }"
+            + " +Number{} +Boolean{} +Character{} +Byte{} +Short{} +Integer{} +Long{} +Float{} +Double{}"
+            + " +String{} +CharSequence{} +StringBuilder{} +Math{} +Comparable{} +Iterable{}"
+            + " }",
+        "java.math +{}",
+        "java.util +{}"
     );
 
     /**
@@ -425,6 +588,41 @@ public interface JexlPermissions {
         return new PermissionsParser().parse(src);
     }
 
+    /**
+     * Wraps these permissions in a {@link LoggingPermissions} that logs every allow/deny decision.
+     * <p>Useful to discover which reflective elements a permission set allows or denies.</p>
+     *
+     * @return a logging view of these permissions
+     * @since 3.7.0
+     */
+    default JexlPermissions logging() {
+        return new LoggingPermissions(this);
+    }
+
+    /**
+     * Wraps these permissions in a {@link LoggingPermissions} that logs every allow/deny decision
+     * to a named logger.
+     *
+     * @param loggerName the name of the logger to log decisions to
+     * @return a logging view of these permissions
+     * @since 3.7.0
+     */
+    default JexlPermissions logging(final String loggerName) {
+        return new LoggingPermissions(loggerName, this);
+    }
+
+    /**
+     * Wraps these permissions in a {@link LoggingPermissions} that logs every allow/deny decision
+     * to the given logger.
+     *
+     * @param log the logger to log decisions to
+     * @return a logging view of these permissions
+     * @since 3.7.0
+     */
+    default JexlPermissions logging(final Log log) {
+        return new LoggingPermissions(log, this);
+    }
+
     /**
      * Checks whether a class allows JEXL introspection.
      * <p>If the class disallows JEXL introspection, none of its constructors, methods or fields
diff --git a/src/main/java/org/apache/commons/jexl3/package-info.java b/src/main/java/org/apache/commons/jexl3/package-info.java
index 61453659..413cbb6f 100644
--- a/src/main/java/org/apache/commons/jexl3/package-info.java
+++ b/src/main/java/org/apache/commons/jexl3/package-info.java
@@ -16,7 +16,7 @@
  */
 
 /**
- * Provides a framework for evaluating JEXL expressions.
+ * Provides a framework for evaluating JEXL expressions and scripts.
  * <ul>
  * <li><a href="#intro">Introduction</a></li>
  * <li><a href="#example">Brief Example</a></li>
@@ -30,34 +30,71 @@
  * JEXL is a library intended to facilitate the implementation of dynamic and scripting features in applications
  * and frameworks.
  * </p>
+ * <p>
+ * The entry point is always a {@link org.apache.commons.jexl3.JexlEngine}, created and configured through a
+ * {@link org.apache.commons.jexl3.JexlBuilder}. An engine is thread-safe and meant to be created once and shared;
+ * it produces {@link org.apache.commons.jexl3.JexlExpression} (single expressions) and
+ * {@link org.apache.commons.jexl3.JexlScript} (multi-statement scripts) which are evaluated against a
+ * {@link org.apache.commons.jexl3.JexlContext} carrying the variable bindings. A
+ * {@link org.apache.commons.jexl3.JxltEngine} adds a JSP/JSF-like templating layer on top of the same engine.
+ * </p>
+ * <p>
+ * <strong>Security note (since 3.7):</strong> a bare {@code new JexlBuilder().create()} engine is hardened by
+ * default. Its permissions are {@link org.apache.commons.jexl3.introspection.JexlPermissions#SECURE} (only a small,
+ * safe allow-list of {@code java.lang}/{@code java.math}/{@code java.util} types is reachable) and its default
+ * {@link org.apache.commons.jexl3.JexlFeatures} disable {@code new(...)}, global side-effects, pragmas and
+ * annotations (lexical scoping is on; loops remain available to scripts). Relax these deliberately - see the
+ * <a href="#configuration">configuration</a> section - rather than by accident.
+ * </p>
+ * <p>
+ * Permissions and features can be set programmatically on the {@link org.apache.commons.jexl3.JexlBuilder} or
+ * loaded from a YAML document through {@link org.apache.commons.jexl3.JexlConfigLoader}, which keeps security
+ * policy out of code and in configuration:
+ * </p>
+ * <pre>
+ * try (InputStream in = getClass().getResourceAsStream("/jexl.yaml")) {
+ *     JexlEngine jexl = JexlConfigLoader.load(in).create();
+ * }
+ * </pre>
+ * <p>
+ * A ready-made {@code jexl.yaml} that restores the pre-3.7 behavior (RESTRICTED permissions, the full feature
+ * set) is bundled as a migration aid; see {@link org.apache.commons.jexl3.JexlConfigLoader} for the full schema.
+ * </p>
  * <h2><a id="example">A Brief Example</a></h2>
  * <p>
  * In its simplest form, JEXL merges an
  * {@link org.apache.commons.jexl3.JexlExpression}
  * with a
  * {@link org.apache.commons.jexl3.JexlContext} when evaluating expressions.
- * An Expression is created using
+ * An expression is created using
  * {@link org.apache.commons.jexl3.JexlEngine#createExpression(String)},
  * passing a String containing valid JEXL syntax.  A simple JexlContext can be created using
  * a {@link org.apache.commons.jexl3.MapContext} instance;
  * a map of variables that will be internally wrapped can be optionally provided through its constructor.
- * The following example, takes a variable named 'car', and
- * invokes the checkStatus() method on the property 'engine'
+ * The following example binds a 'name' variable, calls a String method on it and concatenates the
+ * result. It relies only on a {@code java.lang.String} and arithmetic, so it runs as-is under the
+ * default (SECURE) permissions - no configuration needed.
  * </p>
  * <pre>
  * // Create a JexlEngine (could reuse one instead)
  * JexlEngine jexl = new JexlBuilder().create();
- * // Create an expression object equivalent to 'car.getEngine().checkStatus()':
- * String jexlExp = "car.engine.checkStatus()";
- * Expression e = jexl.createExpression( jexlExp );
- * // The car we have to handle coming as an argument...
- * Car car = theCarThatWeHandle;
+ * // An expression using a variable, a String method call and concatenation:
+ * String jexlExp = "'Hello ' + name + ', your name has ' + name.length() + ' letters'";
+ * JexlExpression e = jexl.createExpression( jexlExp );
  * // Create a context and add data
  * JexlContext jc = new MapContext();
- * jc.set("car", car );
- * // Now evaluate the expression, getting the result
+ * jc.set("name", "John");
+ * // Now evaluate the expression; result is "Hello John, your name has 4 letters"
  * Object o = e.evaluate(jc);
  * </pre>
+ * <p>
+ * To expose your <em>own</em> classes (a {@code Car} bean, a service, ...) to scripts, you must permit them
+ * explicitly: the default SECURE permissions deny application types, and passing an instance through the
+ * {@link org.apache.commons.jexl3.JexlContext} does not bypass that gate - the introspector still checks the
+ * object's class. Grant access by composing your package into the permission set
+ * (e.g. {@code new JexlBuilder().permissions(JexlPermissions.RESTRICTED.compose("com.example.app +{}"))})
+ * or choose a broader base; see the <a href="#configuration">configuration</a> section on permissions.
+ * </p>
  * <h2><a id="usage">Using JEXL</a></h2>
  * The API is composed of three levels addressing different functional needs:
  * <ul>
@@ -75,7 +112,7 @@
  * The following packages follow a "use at your own maintenance cost" policy; these are only intended to be used
  * for extending JEXL.
  * Their classes and methods are not guaranteed to remain compatible in subsequent versions.
- * If you think you need to use  directly some of their features or methods, it might be a good idea to check with
+ * If you think you need to use directly some of their features or methods, it might be a good idea to check with
  * the community through the mailing list first.
  * </p>
  * <ul>
@@ -84,6 +121,10 @@
  * <li>org.apache.commons.jexl3.internal</li>
  * <li>org.apache.commons.jexl3.internal.introspection</li>
  * </ul>
+ * <p>
+ * Note that the {@code org.apache.commons.jexl3.scripting} package implements the JSR-223
+ * ({@code javax.script}) integration through {@link org.apache.commons.jexl3.scripting.JexlScriptEngine}.
+ * </p>
  * <h3><a id="usage_api">Dynamic Invocation</a></h3>
  * <p>
  * These functionalities are close to the core level utilities found in
@@ -151,7 +192,7 @@
  * JexlContext jc = new MapContext();
  * jc.set("quuxClass", quux.class);
  * JexlExpression create = jexl.createExpression("quux = new(quuxClass, 'xuuq', 100)");
- * JelxExpression assign = jexl.createExpression("quux.froboz.value = 10");
+ * JexlExpression assign = jexl.createExpression("quux.froboz.value = 10");
  * JexlExpression check = jexl.createExpression("quux[\"froboz\"].value");
  * Quux quux = (Quux) create.evaluate(jc);
  * Object o = assign.evaluate(jc);
@@ -234,52 +275,106 @@
  * </code></pre>
  * <h2><a id="configuration">JEXL Configuration</a></h2>
  * <p>
- * The JexlEngine can be configured through a few parameters that will drive how it reacts
- * in case of errors.
- * These configuration methods are embedded through a {@link org.apache.commons.jexl3.JexlBuilder}.
+ * Almost everything is configured through a {@link org.apache.commons.jexl3.JexlBuilder} before the engine is
+ * created. The builder controls four largely orthogonal concerns:
  * </p>
- * <h3><a id="static_configuration">Static &amp; Shared Configuration</a></h3>
+ * <ul>
+ * <li><strong>Permissions</strong> ({@link org.apache.commons.jexl3.introspection.JexlPermissions}) -
+ *     <em>what</em> classes, methods and fields scripts may reach through reflection.</li>
+ * <li><strong>Features</strong> ({@link org.apache.commons.jexl3.JexlFeatures}) -
+ *     <em>which</em> syntactic constructs are accepted at parse time.</li>
+ * <li><strong>Options</strong> ({@link org.apache.commons.jexl3.JexlOptions}) -
+ *     <em>how</em> the interpreter behaves at runtime (strict, silent, safe, cancellable, lexical, math).</li>
+ * <li><strong>Bindings</strong> (namespaces, imports, arithmetic, class loader, caches) -
+ *     the environment scripts execute against.</li>
+ * </ul>
  * <p>
- * Both JexlEngine and JxltEngine are thread-safe, most of their inner fields are final; the same instance can
- * be shared between different  threads and proper synchronization is enforced in critical areas (introspection caches).
+ * For a declarative alternative, {@link org.apache.commons.jexl3.JexlConfigLoader} builds a pre-configured
+ * {@link org.apache.commons.jexl3.JexlBuilder} from a YAML document covering permissions, features, arithmetic,
+ * namespaces and imports - convenient for externalizing configuration or restoring pre-3.7 defaults.
  * </p>
+ * <h3><a id="config_security">Security: permissions, sandbox and {@code @NoJexl}</a></h3>
  * <p>
- * Of particular importance is {@link org.apache.commons.jexl3.JexlBuilder#loader(java.lang.ClassLoader)} which indicates
- * to the JexlEngine being built which class loader to use to solve a class name;
- * this directly affects how JexlEngine.newInstance and the 'new' script method operates.
+ * {@link org.apache.commons.jexl3.introspection.JexlPermissions} is the primary security gate; it controls which
+ * packages, classes and members the introspection layer will expose. Three constants are provided:
+ * {@link org.apache.commons.jexl3.introspection.JexlPermissions#UNRESTRICTED} (everything),
+ * {@link org.apache.commons.jexl3.introspection.JexlPermissions#RESTRICTED} (a broad but curated allow-list) and
+ * {@link org.apache.commons.jexl3.introspection.JexlPermissions#SECURE} (the minimal safe allow-list and the
+ * default since 3.7). A permission set is configured with
+ * {@link org.apache.commons.jexl3.JexlBuilder#permissions(org.apache.commons.jexl3.introspection.JexlPermissions)}
+ * and can be composed from a textual DSL through
+ * {@link org.apache.commons.jexl3.introspection.JexlPermissions#parse(java.lang.String...)} or
+ * {@code RESTRICTED.compose("com.example.api +{}")}. To diagnose what a permission set allows or denies under your
+ * workload, wrap it with {@link org.apache.commons.jexl3.introspection.JexlPermissions#logging()}.
  * </p>
  * <p>
- * This can also be very useful in cases where you rely on JEXL to dynamically load and call plugins for your application.
- * To avoid having to restart the server in case of a plugin implementation change, you can call
- * {@link org.apache.commons.jexl3.JexlEngine#setClassLoader} and all the scripts created through this engine instance
- * will automatically point to the newly loaded classes.
+ * Two finer-grained mechanisms complement permissions: the
+ * {@link org.apache.commons.jexl3.annotations.NoJexl} annotation completely shields annotated classes and members
+ * from introspection at the source level, while a
+ * {@link org.apache.commons.jexl3.introspection.JexlSandbox} - set through
+ * {@link org.apache.commons.jexl3.JexlBuilder#sandbox(org.apache.commons.jexl3.introspection.JexlSandbox)} - gives
+ * per-class allow/deny control over properties and methods at configuration time.
+ * </p>
+ * <h3><a id="config_features">Language features (parse time)</a></h3>
+ * <p>
+ * {@link org.apache.commons.jexl3.JexlFeatures} restricts the grammar a script may use; violations are reported as
+ * {@link org.apache.commons.jexl3.JexlException.Feature} when the script is compiled, before any evaluation. Among
+ * the toggles are {@code newInstance} ({@code new(...)}), {@code loops}, {@code sideEffect}/{@code sideEffectGlobal},
+ * {@code lambda}, {@code methodCall}, {@code structuredLiteral}, {@code pragma}, {@code annotation} and lexical
+ * scoping. A feature set is applied with {@link org.apache.commons.jexl3.JexlBuilder#features(org.apache.commons.jexl3.JexlFeatures)};
+ * convenient bases are {@link org.apache.commons.jexl3.JexlFeatures#createDefault()},
+ * {@link org.apache.commons.jexl3.JexlFeatures#createScript()}, {@link org.apache.commons.jexl3.JexlFeatures#createAll()}
+ * and {@link org.apache.commons.jexl3.JexlFeatures#createNone()}.
  * </p>
  * <p>
- * You can state what can be manipulated through scripting by the {@link org.apache.commons.jexl3.annotations.NoJexl}
- * annotation that completely shield classes and methods from JEXL introspection.
- * The other configurable way to restrict JEXL is by using a
- * {@link org.apache.commons.jexl3.introspection.JexlSandbox} which allows finer control over what is exposed; the sandbox
- * can be set through {@link org.apache.commons.jexl3.JexlBuilder#sandbox(org.apache.commons.jexl3.introspection.JexlSandbox)}.
+ * Since expressions are parsed as a single expression, statement-level features (loops, multiple statements, ...)
+ * never apply to them regardless of the feature set; they are relevant to scripts only.
  * </p>
+ * <h3><a id="config_options">Runtime options</a></h3>
  * <p>
- * {@link org.apache.commons.jexl3.JexlBuilder#namespaces} extends JEXL scripting by registering your own classes as
- * namespaces allowing your own functions to be exposed at will.
+ * {@link org.apache.commons.jexl3.JexlOptions} carries the behavioral flags evaluated at runtime. They can be set
+ * as engine defaults either through the dedicated builder shortcuts or by mutating the builder's option set returned
+ * by {@link org.apache.commons.jexl3.JexlBuilder#options()}:
+ * </p>
+ * <ul>
+ * <li>{@link org.apache.commons.jexl3.JexlBuilder#strict(boolean)} - whether {@code null} operands, unknown
+ *     variables or failed calls are errors.</li>
+ * <li>{@link org.apache.commons.jexl3.JexlBuilder#silent(boolean)} - whether errors throw
+ *     {@link org.apache.commons.jexl3.JexlException} (unchecked) or are logged and yield {@code null}.</li>
+ * <li>{@link org.apache.commons.jexl3.JexlBuilder#safe(boolean)} - whether safe-navigation ({@code x?.y}) tolerates
+ *     {@code null} on dereference.</li>
+ * <li>{@link org.apache.commons.jexl3.JexlBuilder#cancellable(boolean)} - whether interrupting the evaluating
+ *     thread raises {@link org.apache.commons.jexl3.JexlException.Cancel}.</li>
+ * <li>{@link org.apache.commons.jexl3.JexlBuilder#lexical(boolean)} /
+ *     {@link org.apache.commons.jexl3.JexlBuilder#lexicalShade(boolean)} - lexical scoping of local variables.</li>
+ * <li>arithmetic strictness and math context, carried by the {@link org.apache.commons.jexl3.JexlArithmetic}
+ *     instance set with {@link org.apache.commons.jexl3.JexlBuilder#arithmetic(org.apache.commons.jexl3.JexlArithmetic)}.</li>
+ * </ul>
+ * <p>
+ * These engine defaults can be overridden per evaluation: a {@link org.apache.commons.jexl3.JexlContext} that also
+ * implements {@link org.apache.commons.jexl3.JexlContext.OptionsHandle} supplies a fresh
+ * {@link org.apache.commons.jexl3.JexlOptions} for each evaluation. (The legacy
+ * {@link org.apache.commons.jexl3.JexlEngine.Options} interface is deprecated in favor of this mechanism.)
+ * </p>
+ * <h3><a id="config_bindings">Namespaces, imports and arithmetic</a></h3>
+ * <p>
+ * {@link org.apache.commons.jexl3.JexlBuilder#namespaces(java.util.Map)} registers your own classes or instances as
+ * namespaces, exposing their methods as {@code prefix:function(...)} calls.
  * </p>
- * This can be used as in:
  * <pre>{@code
- * public static MyMath {
- * public double cos(double x) {
- * return Math.cos(x);
- * }
+ * public static class MyMath {
+ *   public double cos(double x) {
+ *     return Math.cos(x);
+ *   }
  * }
  * Map<String, Object> funcs = new HashMap<String, Object>();
  * funcs.put("math", new MyMath());
  * JexlEngine jexl = new JexlBuilder().namespaces(funcs).create();
  * JexlContext jc = new MapContext();
  * jc.set("pi", Math.PI);
- * JexlExpression e = JEXL.createExpression("math:cos(pi)");
- * o = e.evaluate(jc);
- * assertEquals(Double.valueOf(-1),o);
+ * JexlExpression e = jexl.createExpression("math:cos(pi)");
+ * Object o = e.evaluate(jc);
+ * assertEquals(Double.valueOf(-1), o);
  * }</pre>
  * <p>
  * If the <em>namespace</em> is a Class and that class declares a constructor that takes a JexlContext (or
@@ -287,52 +382,79 @@
  * expression; this instance lifetime is limited to the expression evaluation.
  * </p>
  * <p>
- * JexlEngine and JxltEngine expression caches can be configured as well. If you intend to use JEXL
- * repeatedly in your application, these are worth configuring since expression parsing is quite heavy.
- * Note that all caches created by JEXL are held through SoftReference; under high memory pressure, the GC will be able
- * to reclaim those caches and JEXL will rebuild them if needed. By default, a JexlEngine does create a cache for
- * "small" expressions and a JxltEngine does create one for Expression.
+ * {@link org.apache.commons.jexl3.JexlBuilder#imports(java.util.Collection)} declares packages whose classes can be
+ * referenced by their unqualified name in {@code new(...)} and type references, mimicking Java imports.
+ * {@link org.apache.commons.jexl3.JexlBuilder#arithmetic(org.apache.commons.jexl3.JexlArithmetic)} substitutes a
+ * custom {@link org.apache.commons.jexl3.JexlArithmetic} - see <a href="#customization">customization</a>.
  * </p>
- * <p>{@link org.apache.commons.jexl3.JexlBuilder#cache(int)} will set how many expressions can be simultaneously cached by the
- * JEXL engine. JxltEngine allows to define the cache size through its constructor.
+ * <h3><a id="static_configuration">Static &amp; Shared Configuration</a></h3>
+ * <p>
+ * Both JexlEngine and JxltEngine are thread-safe, most of their inner fields are final; the same instance can
+ * be shared between different threads and proper synchronization is enforced in critical areas (introspection caches).
  * </p>
  * <p>
- * {@link org.apache.commons.jexl3.JexlBuilder#debug(boolean)}
- * makes stack traces carried by JExlException more meaningful; in particular, these
- * traces will carry the exact caller location the Expression was created from.
+ * The library-wide defaults applied by a bare {@code new JexlBuilder()} are themselves configurable through static
+ * setters: {@link org.apache.commons.jexl3.JexlBuilder#setDefaultPermissions(org.apache.commons.jexl3.introspection.JexlPermissions)}
+ * and {@link org.apache.commons.jexl3.JexlBuilder#setDefaultFeatures(org.apache.commons.jexl3.JexlFeatures)}. The
+ * pre-3.7 permissive feature set is exposed as {@link org.apache.commons.jexl3.JexlBuilder#FULL} so an application
+ * can restore the legacy behavior process-wide in one place.
+ * </p>
+ * <p>
+ * Of particular importance is {@link org.apache.commons.jexl3.JexlBuilder#loader(java.lang.ClassLoader)} which indicates
+ * to the JexlEngine being built which class loader to use to solve a class name;
+ * this directly affects how JexlEngine.newInstance and the 'new' script method operates.
  * </p>
- * <h3><a id="dynamic_configuration">Dynamic Configuration</a></h3>
  * <p>
- * Those configuration options can be overridden during evaluation by implementing a
- * {@link org.apache.commons.jexl3.JexlContext}
- * that also implements {@link org.apache.commons.jexl3.JexlEngine.Options} to carry evaluation options.
- * An example of such a class exists in the test package.
+ * This can also be very useful in cases where you rely on JEXL to dynamically load and call plugins for your application.
+ * To avoid having to restart the server in case of a plugin implementation change, you can call
+ * {@link org.apache.commons.jexl3.JexlEngine#setClassLoader} and all the scripts created through this engine instance
+ * will automatically point to the newly loaded classes.
  * </p>
+ * <h3><a id="config_cache">Caches &amp; debugging</a></h3>
  * <p>
- * {@link org.apache.commons.jexl3.JexlBuilder#strict} or {@link org.apache.commons.jexl3.JexlEngine.Options#isStrict}
- * configures when JEXL considers 'null' as an error or not in various situations;
- * when facing an unreferenceable variable, using null as an argument to an arithmetic operator or failing to call
- * a method or constructor. The lenient mode is close to JEXL-1.1 behavior.
+ * JexlEngine and JxltEngine expression caches can be configured as well. If you intend to use JEXL
+ * repeatedly in your application, these are worth configuring since expression parsing is quite heavy.
+ * Note that all caches created by JEXL are held through {@code SoftReference}; under high memory pressure, the GC will
+ * be able to reclaim those caches and JEXL will rebuild them if needed. By default, a JexlEngine does create a cache
+ * for "small" expressions and a JxltEngine does create one for Expression.
+ * </p>
+ * <p>{@link org.apache.commons.jexl3.JexlBuilder#cache(int)} sets how many expressions can be simultaneously cached by
+ * the JEXL engine, {@link org.apache.commons.jexl3.JexlBuilder#cacheThreshold(int)} caps the size of cached
+ * expressions, and {@link org.apache.commons.jexl3.JexlBuilder#cacheFactory(java.util.function.IntFunction)} lets you
+ * supply an alternative {@link org.apache.commons.jexl3.JexlCache} implementation. JxltEngine allows defining the
+ * cache size through its constructor.
  * </p>
  * <p>
- * {@link org.apache.commons.jexl3.JexlBuilder#silent} or {@link org.apache.commons.jexl3.JexlEngine.Options#isSilent}
- * configures how JEXL reacts to errors; if silent, the engine will not throw exceptions
- * but will warn through loggers and return null in case of errors. Note that when non-silent, JEXL throws
- * JexlException which are unchecked exception.
+ * {@link org.apache.commons.jexl3.JexlBuilder#debug(boolean)}
+ * makes stack traces carried by JexlException more meaningful; in particular, these
+ * traces will carry the exact caller location the Expression was created from.
  * </p>
+ * <h3><a id="dynamic_configuration">Dynamic Configuration</a></h3>
  * <p>
- * Implementing a {@link org.apache.commons.jexl3.JexlContext.NamespaceResolver} through a JexlContext - look at
- * JexlEvalContext in the test directory
- * as an example - allows to override the namespace resolution and the default namespace map defined
- * through {@link org.apache.commons.jexl3.JexlBuilder#namespaces}.
+ * Beyond options, a {@link org.apache.commons.jexl3.JexlContext} can implement a number of handles to override
+ * engine behavior on a per-evaluation basis. The {@code MapContext}/{@link org.apache.commons.jexl3.ObjectContext}
+ * implementations cover the common cases; for finer control, implement one or more of:
  * </p>
+ * <ul>
+ * <li>{@link org.apache.commons.jexl3.JexlContext.OptionsHandle} - supply per-evaluation
+ *     {@link org.apache.commons.jexl3.JexlOptions}.</li>
+ * <li>{@link org.apache.commons.jexl3.JexlContext.NamespaceResolver} - override namespace resolution and the
+ *     default namespace map defined through {@link org.apache.commons.jexl3.JexlBuilder#namespaces(java.util.Map)}.</li>
+ * <li>{@link org.apache.commons.jexl3.JexlContext.AnnotationProcessor} - handle {@code @annotation} statements.</li>
+ * <li>{@link org.apache.commons.jexl3.JexlContext.PragmaProcessor} - react to {@code #pragma} directives.</li>
+ * <li>{@link org.apache.commons.jexl3.JexlContext.ModuleProcessor} - resolve {@code #pragma jexl.module} imports.</li>
+ * <li>{@link org.apache.commons.jexl3.JexlContext.ClassNameResolver} - resolve unqualified class names.</li>
+ * <li>{@link org.apache.commons.jexl3.JexlContext.CancellationHandle} - expose a cancellation flag to interrupt
+ *     evaluation.</li>
+ * <li>{@link org.apache.commons.jexl3.JexlContext.ThreadLocal} - bind context data to the evaluating thread.</li>
+ * </ul>
  * <h2><a id="customization">JEXL Customization</a></h2>
  * <p>
  * The {@link org.apache.commons.jexl3.JexlContext}, {@link org.apache.commons.jexl3.JexlBuilder} and
- * {@link org.apache.commons.jexl3.JexlEngine.Options} are
+ * {@link org.apache.commons.jexl3.JexlOptions} are
  * the most likely interfaces you'll want to implement for customization. Since they expose variables and options,
- * they are the primary targets. Before you do so, have a look at JexlEvalContext in the test directory
- * and {@link org.apache.commons.jexl3.ObjectContext} which may already cover some of your needs.
+ * they are the primary targets. Before you do so, have a look at
+ * {@link org.apache.commons.jexl3.ObjectContext} which may already cover some of your needs.
  * </p>
  * <p>
  * {@link org.apache.commons.jexl3.JexlArithmetic}
@@ -351,7 +473,7 @@
  * If you overload some in your JexlArithmetic derived implementation, these methods will be called when the
  * arguments match your method signature.
  * For example, this would be the case if you wanted '+' to operate on arrays; you'd need to derive
- * JexlArithmetic and implement '{@code public Object add(Set<?;> x, Set<?;> y)}' method.
+ * JexlArithmetic and implement a {@code public Object add(Set<?> x, Set<?> y)} method.
  * Note however that you can <em>not</em> change the operator precedence.
  * The list of operator / method matches is described in {@link org.apache.commons.jexl3.JexlOperator}:
  * </p>
@@ -396,8 +518,8 @@
  * <p>
  * {@link org.apache.commons.jexl3.internal.Engine} can be
  * extended to let you capture your own configuration defaults regarding cache sizes and various flags.
- * Implementing your own cache - instead of the basic LinkedHashMap based one - would be
- * another possible extension.
+ * Implementing your own {@link org.apache.commons.jexl3.JexlCache} - instead of the default soft-reference based one -
+ * would be another possible extension.
  * </p>
  * <p>
  * {@link org.apache.commons.jexl3.internal.Interpreter}
diff --git a/src/main/java/org/apache/commons/jexl3/scripting/JexlScriptEngineFactory.java b/src/main/java/org/apache/commons/jexl3/scripting/JexlScriptEngineFactory.java
index f72be2e2..ee92be62 100644
--- a/src/main/java/org/apache/commons/jexl3/scripting/JexlScriptEngineFactory.java
+++ b/src/main/java/org/apache/commons/jexl3/scripting/JexlScriptEngineFactory.java
@@ -130,7 +130,7 @@ public class JexlScriptEngineFactory implements ScriptEngineFactory {
 
     @Override
     public String getEngineVersion() {
-        return "3.6"; // ensure this is updated if function changes are made to this class
+        return "3.7"; // ensure this is updated if function changes are made to this class
     }
 
     @Override
@@ -145,7 +145,7 @@ public class JexlScriptEngineFactory implements ScriptEngineFactory {
 
     @Override
     public String getLanguageVersion() {
-        return "3.6"; // this should be derived from the actual version
+        return "3.7"; // this should be derived from the actual version
     }
 
     @Override
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index 470f9e58..c3552ec5 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -22,6 +22,53 @@
     </properties>
 
     <body>
+        <section name="Breaking change in 3.7.0">
+            <p>
+              JEXL 3.7.0 changes two defaults that can break existing applications at <em>parse time</em>:
+            </p>
+            <ul>
+              <li>The default permissions are now <strong>SECURE</strong>: only a safe subset of
+                  <code>java.lang</code>, <code>java.math</code>, and <code>java.util</code> is
+                  accessible.  Classes outside that set are denied unless explicitly composed in.</li>
+              <li>The default features <strong>disable</strong> <code>new(...)</code>, global
+                  side-effects, pragmas, and annotations, and <strong>enable</strong> lexical scoping;
+                  loops remain available to scripts (but never to expressions).  Scripts using a
+                  disabled construct will throw <code>JexlException.Feature</code> when compiled.</li>
+            </ul>
+            <p>
+              The fastest migration is to load <code>jexl.yaml</code> via
+              <a href="apidocs/org/apache/commons/jexl3/JexlConfigLoader.html">JexlConfigLoader</a>:
+              it restores RESTRICTED permissions and enables <code>new</code>, loops, side-effects,
+              and lambdas — matching the 3.6 defaults.
+            </p>
+            <pre>
+try (InputStream in = getClass().getResourceAsStream("/jexl.yaml")) {
+    JexlEngine engine = JexlConfigLoader.load(in).create();
+}
+            </pre>
+            <p>
+              Alternatively, you can restore the pre-3.7 behavior process-wide in a few lines of code by
+              resetting the static defaults before building any engine — use
+              <a href="apidocs/org/apache/commons/jexl3/JexlBuilder.html">JexlBuilder.setDefaultPermissions</a>
+              to revert the permissions and
+              <a href="apidocs/org/apache/commons/jexl3/JexlBuilder.html">JexlBuilder.setDefaultFeatures</a>
+              to revert the feature set (<code>JexlBuilder.FULL</code> is the pre-3.7 feature set):
+            </p>
+            <pre>
+JexlBuilder.setDefaultPermissions(JexlPermissions.RESTRICTED);
+JexlBuilder.setDefaultFeatures(JexlBuilder.FULL);
+            </pre>
+            <p>
+              Conversely, to keep the tighter control and discover which classes are now denied under your
+              workload, wrap your permission set with
+              <a href="apidocs/org/apache/commons/jexl3/introspection/JexlPermissions.html">JexlPermissions.logging()</a>:
+              each distinct allow/deny decision is logged once.
+            </p>
+            <p>
+              For full details and the full migration recipe, see the
+              <a href="relnotes.html">release notes</a>.
+            </p>
+        </section>
         <section name="Java Expression Language (JEXL)">
             <p>
 JEXL is a library intended to facilitate the implementation of dynamic and scripting features in
@@ -68,6 +115,46 @@ and ensure their execution within controlled functional constraints.
                     </li>
                 </ul>
             </p>
+            <p>
+              What sets JEXL apart from other embeddable scripting and expression engines
+              (Groovy, JavaScript/Nashorn, MVEL, Spring SpEL, ...) is that <strong>control and security are
+              designed-in, first-class concerns</strong> rather than afterthoughts:
+            </p>
+            <ul>
+              <li><strong>Secure by default, allow-list permissions.</strong>
+                  <a href="apidocs/org/apache/commons/jexl3/introspection/JexlPermissions.html">JexlPermissions</a>
+                  gate every class, method and field a script may reach through reflection. The default is
+                  <code>SECURE</code> - a minimal allow-list - so nothing in your application or the JDK (file system,
+                  process and network APIs, class loaders, reflection) is exposed unless you explicitly permit it. The
+                  <code>@NoJexl</code> annotation and a
+                  <a href="apidocs/org/apache/commons/jexl3/introspection/JexlSandbox.html">JexlSandbox</a> add
+                  source-level and per-class control on top.</li>
+              <li><strong>Parse-time language shaping.</strong>
+                  <a href="apidocs/org/apache/commons/jexl3/JexlFeatures.html">JexlFeatures</a> switch syntactic
+                  constructs on or off - loops, <code>new</code>, side-effects, lambdas, annotations, pragmas - so you
+                  can offer end-users a deliberately small, safe language surface and reject anything else <em>before</em>
+                  a single line is evaluated.</li>
+              <li><strong>No code generation, no class-loading leaks.</strong>
+                  JEXL interprets a parsed syntax tree; it does not compile scripts to bytecode or define new classes
+                  per script. That avoids the metaspace growth, class-loader retention and wide attack surface typical
+                  of compile-to-bytecode engines, and keeps long-lived, high-churn server usage predictable.</li>
+              <li><strong>Tiny footprint.</strong>
+                  A small, focused API (the core fits in a handful of classes) with a single runtime dependency
+                  (commons-logging) - easy to embed, reason about and audit.</li>
+              <li><strong>Tunable runtime behavior.</strong>
+                  <a href="apidocs/org/apache/commons/jexl3/JexlOptions.html">Options</a> - strict, silent,
+                  safe-navigation, lexical scoping, arithmetic <code>MathContext</code>, and cooperative
+                  <em>cancellation</em> of a running script - can be set per engine or overridden per evaluation.</li>
+              <li><strong>Deep, typed integration.</strong>
+                  Operator overloading and custom types through a derived
+                  <a href="apidocs/org/apache/commons/jexl3/JexlArithmetic.html">JexlArithmetic</a>, custom variable
+                  resolution through <a href="apidocs/org/apache/commons/jexl3/JexlContext.html">JexlContext</a>, and
+                  your own functions exposed as callable namespaces.</li>
+              <li><strong>Declarative configuration.</strong>
+                  Permissions, features, arithmetic and namespaces can be loaded from a YAML document through
+                  <a href="apidocs/org/apache/commons/jexl3/JexlConfigLoader.html">JexlConfigLoader</a>, keeping
+                  security policy in configuration rather than scattered through code.</li>
+            </ul>
             <p>
             JEXL name stands for Java EXpression Language, a simple expression language originally inspired by Apache
             Velocity and the Expression Language defined in the JavaServer Pages Standard Tag Library version 1.1 (JSTL)
diff --git a/src/site/xdoc/relnotes.xml b/src/site/xdoc/relnotes.xml
index d9b9808f..1de9df81 100644
--- a/src/site/xdoc/relnotes.xml
+++ b/src/site/xdoc/relnotes.xml
@@ -18,15 +18,59 @@
 
 <document>
   <properties>
-    <title>Apache Commons JEXL 3.6.4 Release Notes</title>
+    <title>Apache Commons JEXL 3.7.0 Release Notes</title>
   </properties>
 
   <body>
     <section name="Compatibility with previous release">
       <p>
-        Version 3.6.4 is source and binary compatible with 3.6.0.
+        Version 3.7.0 is source and binary compatible with 3.6.x but it changes default runtime and
+        parse-time behavior.
       </p>
     </section>
+    <section name="Compatibility with older releases (&lt; 3.7)">
+      <p>
+        Since 3.7.0 the default permissions are <em>SECURE</em> (was RESTRICTED since 3.3) and the
+        default features disable <code>new(...)</code>, global side-effects, pragmas, and annotations
+        (lexical scoping is enabled; loops remain available to scripts).  Because features are enforced
+        at <em>parse time</em>, existing scripts that use a disabled construct will throw
+        <code>JexlException.Feature</code> when compiled against a 3.7 engine built with the default
+        settings.
+      </p>
+      <p>
+        Despite the obvious inconvenience - our sincere apologies on the matter -, how much functional
+        and semantic power is accessible through scripts has a real impact on your application security
+        and stability; that potential risk requires an informed review and conscious choice on your end.
+        Whether Files, URLs, networking, processes, class-loaders or reflection classes
+        or whether loops or side effects are accessible may be used as ingress points for nefarious usage.
+      </p>
+      <p>
+        The fastest mitigation is to load the bundled <code>jexl.yaml</code> configuration
+        (see <a href="apidocs/org/apache/commons/jexl3/JexlConfigLoader.html">JexlConfigLoader</a>)
+        which restores RESTRICTED permissions and enables <code>new</code>, loops, side-effects, and
+        lambdas:
+      </p>
+      <pre>
+try (InputStream in = getClass().getResourceAsStream("/jexl.yaml")) {
+    JexlEngine engine = JexlConfigLoader.load(in).create();
+}
+      </pre>
+      <p>
+        To discover which reflective elements the new SECURE permissions now deny in your workload,
+        wrap your permission set with
+        <a href="apidocs/org/apache/commons/jexl3/introspection/JexlPermissions.html">JexlPermissions.logging()</a>
+        before constructing the engine: each allow/deny decision is logged once.
+      </p>
+      <p>
+      As another mitigation approach, you can revert to the previous behaviors with a few lines of code
+      (see <a href="apidocs/org/apache/commons/jexl3/introspection/JexlPermissions.html">JexlPermissions</a>,
+        <a href="apidocs/org/apache/commons/jexl3/JexlFeatures.html">JexlFeatures</a>,
+      <a href="apidocs/org/apache/commons/jexl3/JexlBuilder.html">JexlBuilder</a>
+      and
+      <a href="apidocs/org/apache/commons/jexl3/scripting/JexlScriptEngine.html">JexlScriptEngine</a>
+      ).
+    </p>
+    </section>
     <section name="Compatibility with older releases (&lt; 3.3, 2.x)">
       <p>
         Since 3.3 release, the default setting for permissions that determine which packages, classes and methods are
@@ -38,25 +82,68 @@
         power is accessible through scripts has a real impact on your application security and stability ;
         that potential risk requires an informed review and conscious choice on your end.
       </p>
+
+    </section>
+
+    <section name="What is new in 3.7.0:">
+      <p>
+        JEXL 3.7.0 hardens the default security posture of the engine.  Two defaults change:
+      </p>
+      <ul>
+        <li>The default permissions become <code>JexlPermissions.SECURE</code> — a minimum allow-list
+            covering only safe <code>java.lang</code> value types, <code>java.math</code>, and
+            <code>java.util</code>.  Everything else (system classes, I/O, reflection, ...) is denied
+            unless explicitly composed in.</li>
+        <li>The default feature set disables <code>new(...)</code>, global side-effects, pragmas, and
+            annotations, and enables lexical scoping; loops remain available to scripts (but never to
+            expressions).  Scripts using a disabled construct will throw <code>JexlException.Feature</code>
+            at parse time.</li>
+      </ul>
+      <p>
+        The RESTRICTED permission set was also hardened: a class is now accessible only when its
+        <em>own</em> package or class is explicitly permitted — access is no longer granted because a
+        super-type or interface sits in an allowed package (the former "reach-through"), which previously
+        exposed the entire foreign class.
+      </p>
+      <p>
+        The new <code>JexlPermissions.logging()</code> wrapper logs every allow/deny decision (each
+        distinct decision logged once) and is the recommended diagnostic when migrating.
+      </p>
       <p>
-        To mitigate the change, you can revert to the previous behavior with one line of code
-        (see <a href="apidocs/org/apache/commons/jexl3/introspection/JexlPermissions.html">JexlPermissions</a>,
-        <a href="apidocs/org/apache/commons/jexl3/JexlBuilder.html">JexlBuilder</a>
-        and
-        <a href="apidocs/org/apache/commons/jexl3/scripting/JexlScriptEngine.html">JexlScriptEngine</a>
-        ) or use this
-        opportunity to reduce exposure. Whether Files, URLs, networking, processes, class-loaders or reflection classes
-        or whether loops or side effects are accessible are part of your choice to make.
+        The permissions DSL gained the ability to deny individual members (such as a constructor) of an
+        otherwise-allowed class, e.g. <code>"java.util +{ -Formatter { Formatter(); } }"</code>.
+      </p>
+      <p>
+        A new <code>JexlConfigLoader</code> lets applications load engine configuration from a YAML
+        file, including permissions (SECURE/RESTRICTED/UNRESTRICTED + compose rules), features, and
+        namespaces.
       </p>
     </section>
-
-    <section name="What is new in 3.6.4:">
+    <section name="New Features in 3.7.0:">
       <p>
-        JEXL 3.6.4 is a minor release that fixes a security issue in the RESTRICTED permission set.
-        It does not introduce any breaking change.
+        <table>
+          <tr>
+            <td>
+              <a href="https://issues.apache.org/jira/browse/JEXL-465">JEXL-465:</a>
+            </td>
+            <td>Add JexlConfigLoader to build a JexlEngine from a YAML configuration.</td>
+          </tr>
+          <tr>
+            <td>
+              <a href="https://issues.apache.org/jira/browse/JEXL-464">JEXL-464:</a>
+            </td>
+            <td>Default permissions are SECURE and default features harden parse-time behavior (disable new, global side-effects, pragmas and annotations; enable lexical scoping; loops remain available to scripts).</td>
+          </tr>
+          <tr>
+            <td>
+              <a href="https://issues.apache.org/jira/browse/JEXL-463">JEXL-463:</a>
+            </td>
+            <td>Add JexlPermissions.logging() to log which reflective elements are allowed or denied.</td>
+          </tr>
+        </table>
       </p>
     </section>
-    <section name="Bugs fixed in 3.6.4:">
+    <section name="Bugs fixed in 3.7.0:">
       <p>
         <table>
           <tr>
diff --git a/src/test/java/org/apache/commons/jexl3/ComposePermissionsTest.java b/src/test/java/org/apache/commons/jexl3/ComposePermissionsTest.java
index 081088c8..90773eb0 100644
--- a/src/test/java/org/apache/commons/jexl3/ComposePermissionsTest.java
+++ b/src/test/java/org/apache/commons/jexl3/ComposePermissionsTest.java
@@ -52,7 +52,7 @@ class ComposePermissionsTest extends JexlTestCase {
             assertNotNull(json);
         }
 
-        // will succeed because java.util.Map is allowed and gson LinkedTreeMap is one
+        // will succeed because the base permissions (UNRESTRICTED) allow the gson LinkedTreeMap
         final JexlEngine j0 = createEngine(false, p);
         final JexlScript s0 = j0.createScript("json.pageInfo.pagePic", "json");
         final Object r0 = s0.execute(null, json);
@@ -70,11 +70,11 @@ class ComposePermissionsTest extends JexlTestCase {
         xproperty = assertThrows(JexlException.Property.class, () -> s2.execute(null, json));
         assertEquals("pageInfo", xproperty.getProperty());
 
-        // will not fail since gson objects
-        j1 = createEngine(false, JexlPermissions.RESTRICTED);
+        // will succeed once the gson package is explicitly allowed (no reach-through via java.util.Map)
+        j1 = createEngine(false, JexlPermissions.RESTRICTED.compose("com.google.gson.internal +{}"));
         final JexlScript s3 = j1.createScript("json.pageInfo.pagePic", "json");
-        s3.execute(null, json);
-        assertEquals(check, r0);
+        final Object r3 = s3.execute(null, json);
+        assertEquals(check, r3);
     }
 
     @Test
diff --git a/src/test/java/org/apache/commons/jexl3/DefaultsTest.java b/src/test/java/org/apache/commons/jexl3/DefaultsTest.java
new file mode 100644
index 00000000..6c4131b0
--- /dev/null
+++ b/src/test/java/org/apache/commons/jexl3/DefaultsTest.java
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.jexl3;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/**
+ * Verifies that a bare {@code new JexlBuilder().create()} uses JEXL 3.7 hardened defaults:
+ * SECURE permissions and features that disable new(), global side-effects, pragmas and annotations,
+ * enable lexical scoping, and allow loops in scripts (but not in expressions).
+ *
+ * <p>This class intentionally does NOT extend JexlTestCase — JexlTestCase sets permissive
+ * defaults to keep the rest of the test suite green, which would defeat the purpose here.</p>
+ */
+public class DefaultsTest {
+
+    @BeforeEach
+    public void restoreHardenedDefaults() {
+        // Override whatever JexlTestCase may have set when running as part of the full suite.
+        JexlBuilder.setDefaultPermissions(null);  // null → SECURE
+        JexlBuilder.setDefaultFeatures(null);     // null → hardened (no new, no loops, no global SE)
+    }
+
+    @AfterEach
+    public void restoreTestPermissive() {
+        JexlBuilder.setDefaultPermissions(JexlTestCase.TEST_PERMS);
+        JexlBuilder.setDefaultFeatures(JexlFeatures.createDefault());
+    }
+
+    @Test
+    public void testDefaultPermissionsAreSecure() {
+        final JexlBuilder builder = new JexlBuilder();
+        assertSame(org.apache.commons.jexl3.introspection.JexlPermissions.SECURE, builder.permissions());
+    }
+
+    @Test
+    public void testNewInstanceDisabledByDefault() {
+        final JexlEngine engine = new JexlBuilder().create();
+        assertThrows(JexlException.Feature.class,
+            () -> engine.createScript("new('java.util.ArrayList')"),
+            "new() must be rejected at parse time under hardened defaults");
+    }
+
+    @Test
+    public void testLoopsEnabledForScriptsNotExpressions() {
+        final JexlEngine engine = new JexlBuilder().create();
+        // loops ARE allowed in scripts
+        assertNotNull(engine.createScript("var s = 0; for (var i : [1,2,3]) { s += i; } s"),
+            "for-loop must be accepted in a script under hardened defaults");
+        // but a loop is not valid in a single expression
+        assertThrows(JexlException.class,
+            () -> engine.createExpression("for (var i : [1,2,3]) { i }"),
+            "for-loop must be rejected in an expression");
+    }
+
+    @Test
+    public void testGlobalSideEffectDisabledByDefault() {
+        final JexlEngine engine = new JexlBuilder().create();
+        assertThrows(JexlException.Feature.class,
+            () -> engine.createScript("x = 1"),
+            "global assignment must be rejected at parse time under hardened defaults");
+    }
+
+    @Test
+    public void testPragmaDisabledByDefault() {
+        final JexlEngine engine = new JexlBuilder().create();
+        assertThrows(JexlException.Feature.class,
+            () -> engine.createScript("#pragma jexl.foo 'bar'\n42"),
+            "pragma must be rejected at parse time under hardened defaults");
+    }
+
+    @Test
+    public void testAnnotationDisabledByDefault() {
+        final JexlEngine engine = new JexlBuilder().create();
+        assertThrows(JexlException.Feature.class,
+            () -> engine.createScript("@silent var x = 1"),
+            "annotation must be rejected at parse time under hardened defaults");
+    }
+
+    @Test
+    public void testLexicalEnabledByDefault() {
+        final JexlEngine engine = new JexlBuilder().create();
+        // lexical shade: a local variable cannot shadow itself / redeclare in the same scope
+        assertThrows(JexlException.class,
+            () -> engine.createScript("var x = 1; var x = 2; x"),
+            "lexical scoping must reject redeclaration under hardened defaults");
+    }
+
+    @Test
+    public void testPackageDocExampleRunsUnderSecure() {
+        // mirrors the "Brief Example" in package-info.java: must run as-is under hardened defaults
+        final JexlEngine jexl = new JexlBuilder().create();
+        final JexlExpression e = jexl.createExpression(
+            "'Hello ' + name + ', your name has ' + name.length() + ' letters'");
+        final JexlContext jc = new MapContext();
+        jc.set("name", "Aiko");
+        assertEquals("Hello Aiko, your name has 4 letters", e.evaluate(jc));
+    }
+
+    @Test
+    public void testSecurePermsDenyRuntime() {
+        final JexlEngine engine = new JexlBuilder().features(JexlFeatures.createDefault()).create();
+        // java.lang.Runtime is denied under SECURE
+        assertThrows(JexlException.class,
+            () -> engine.createScript("Runtime.getRuntime()").execute(new MapContext()),
+            "Runtime should be denied under SECURE permissions");
+    }
+}
diff --git a/src/test/java/org/apache/commons/jexl3/Issues400Test.java b/src/test/java/org/apache/commons/jexl3/Issues400Test.java
index d57805b5..7aa3826f 100644
--- a/src/test/java/org/apache/commons/jexl3/Issues400Test.java
+++ b/src/test/java/org/apache/commons/jexl3/Issues400Test.java
@@ -1237,5 +1237,26 @@ public class Issues400Test {
         result = script.execute(jc);
         assertEquals(42, result);
     }
+
+    @Test
+    void test462() {
+        // JEXL-462: under RESTRICTED, java.io.PrintWriter is reachable and its methods are allowed,
+        // but its constructors are denied - it cannot be instantiated from a script.
+        final JexlEngine jexl = new JexlBuilder().silent(false).permissions(RESTRICTED).create();
+        for (final String src : new String[] {
+                "new('java.io.PrintWriter', new('java.io.StringWriter'))",
+                "import java.io.PrintWriter; new PrintWriter(new('java.io.StringWriter'))" }) {
+            final JexlScript script = jexl.createScript(src);
+            final JexlException.Method xctor = assertThrows(JexlException.Method.class,
+                () -> script.execute(null), () -> "PrintWriter::new should be denied: " + src);
+            assertTrue(xctor.getMethod().contains("PrintWriter"));
+        }
+        // a PrintWriter method (println) is allowed on a provided instance
+        final StringWriter sw = new StringWriter();
+        final java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+        jexl.createScript("p.println('hello')", "p").execute(null, pw);
+        pw.flush();
+        assertTrue(sw.toString().contains("hello"));
+    }
 }
 
diff --git a/src/test/java/org/apache/commons/jexl3/JexlConfigLoaderTest.java b/src/test/java/org/apache/commons/jexl3/JexlConfigLoaderTest.java
new file mode 100644
index 00000000..0f31ae08
--- /dev/null
+++ b/src/test/java/org/apache/commons/jexl3/JexlConfigLoaderTest.java
@@ -0,0 +1,243 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.jexl3;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Tests for {@link JexlConfigLoader}.
+ */
+public class JexlConfigLoaderTest {
+
+    /** Namespace example: static math helpers callable as {@code mymath:square(n)}. */
+    public static class MathNs {
+        public static int square(final int n) { return n * n; }
+        public static double abs(final double x) { return Math.abs(x); }
+    }
+
+    /** Permissions example: explicitly allowed by a compose() rule in the YAML. */
+    public static class Permitted {
+        public String greet(final String name) { return "Hello, " + name; }
+    }
+
+    private static InputStream yaml(final String content) {
+        return new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8));
+    }
+
+    private InputStream resource(final String name) {
+        final InputStream in = getClass().getResourceAsStream(name);
+        Assertions.assertNotNull(in, "test resource not found: " + name);
+        return in;
+    }
+
+    @Test
+    public void testLoadFromResource() throws Exception {
+        try (InputStream in = resource("test-config.yaml")) {
+            final JexlBuilder builder = JexlConfigLoader.load(in);
+            Assertions.assertNotNull(builder);
+        }
+    }
+
+    @Test
+    public void testStrictModeFromYaml() throws Exception {
+        try (InputStream in = yaml("strict: true\nsafe: false\n")) {
+            final JexlEngine engine = JexlConfigLoader.load(in).create();
+            Assertions.assertThrows(JexlException.class,
+                () -> engine.createExpression("undeclaredVar + 1").evaluate(new MapContext()));
+        }
+    }
+
+    @Test
+    public void testFeaturesFromYaml() throws Exception {
+        try (InputStream in = yaml("features:\n  loops: true\n  lambda: true\n  sideEffect: true\n")) {
+            final JexlEngine engine = JexlConfigLoader.load(in).create();
+            final JexlScript loop = engine.createScript(
+                "var s = 0; for (var i : [1,2,3]) { s += i; } s");
+            Assertions.assertEquals(6, ((Number) loop.execute(new MapContext())).intValue());
+        }
+    }
+
+    @Test
+    public void testNamespaceFromYaml() throws Exception {
+        final String ns = MathNs.class.getName();
+        try (InputStream in = yaml("permissions:\n  base: RESTRICTED\nnamespaces:\n  mymath: " + ns + "\n")) {
+            final JexlEngine engine = JexlConfigLoader.load(in).create();
+            final Object result = engine.createScript("mymath:square(4)")
+                .execute(new MapContext());
+            Assertions.assertEquals(16, result);
+        }
+    }
+
+    @Test
+    public void testPermissionsFromYaml() throws Exception {
+        try (InputStream in = resource("test-config.yaml")) {
+            final JexlEngine engine = JexlConfigLoader.load(in).create();
+            Assertions.assertThrows(JexlException.class,
+                () -> engine.createScript("new('java.lang.Runtime')").execute(new MapContext()));
+        }
+    }
+
+    @Test
+    public void testFullResourceConfig() throws Exception {
+        try (InputStream in = resource("test-config.yaml")) {
+            final JexlEngine engine = JexlConfigLoader.load(in).create();
+            Assertions.assertNotNull(engine);
+
+            Assertions.assertThrows(JexlException.class,
+                () -> engine.createExpression("ghost + 1").evaluate(new MapContext()));
+
+            final Object r = engine.createScript("math:random() >= 0").execute(new MapContext());
+            Assertions.assertEquals(Boolean.TRUE, r);
+
+            final Number sum = (Number) engine.createScript(
+                "var s = 0; for (var i : [1,2,3]) { s += i; } s").execute(new MapContext());
+            Assertions.assertEquals(6, sum.intValue());
+        }
+    }
+
+    @Test
+    public void testEngineConvenience() throws Exception {
+        try (InputStream in = yaml("strict: false\n")) {
+            final JexlEngine engine = JexlConfigLoader.engine(in);
+            Assertions.assertNotNull(engine);
+        }
+    }
+
+    @Test
+    public void testInvalidArithmeticClass() throws Exception {
+        try (InputStream in = yaml("arithmetic:\n  clazz: com.example.NoSuchClass\n  strict: true\n")) {
+            Assertions.assertThrows(IllegalArgumentException.class,
+                () -> JexlConfigLoader.load(in));
+        }
+    }
+
+    @Test
+    public void testInvalidNamespaceClass() throws Exception {
+        try (InputStream in = yaml("namespaces:\n  bad: com.example.NoSuchClass\n")) {
+            Assertions.assertThrows(IllegalArgumentException.class,
+                () -> JexlConfigLoader.load(in));
+        }
+    }
+
+    @Test
+    public void testEmptyYaml() throws Exception {
+        try (InputStream in = yaml("")) {
+            Assertions.assertNotNull(JexlConfigLoader.load(in).create());
+        }
+    }
+
+    @Test
+    public void testCommentOnlyYaml() throws Exception {
+        try (InputStream in = yaml("# just a comment\n")) {
+            Assertions.assertNotNull(JexlConfigLoader.load(in).create());
+        }
+    }
+
+    @Test
+    public void testInlineComment() throws Exception {
+        try (InputStream in = yaml("strict: true  # enable strict mode\ncache: 256 # cache size\n")) {
+            Assertions.assertNotNull(JexlConfigLoader.load(in).create());
+        }
+    }
+
+    @Test
+    public void testImportsList() throws Exception {
+        try (InputStream in = yaml("imports:\n  - java.lang\n  - java.util\n")) {
+            Assertions.assertNotNull(JexlConfigLoader.load(in).create());
+        }
+    }
+
+    @Test
+    public void testPermissionsWithRules() throws Exception {
+        final String canonical = Permitted.class.getCanonicalName();
+        final String binary    = Permitted.class.getName();
+        final String content =
+            "permissions:\n"
+            + "  base: RESTRICTED\n"
+            + "  classes:\n"
+            + "    - " + canonical + "\n";
+        try (InputStream in = yaml(content)) {
+            final JexlEngine engine = JexlConfigLoader.load(in).create();
+            final Object result = engine.createScript(
+                "new('" + binary + "').greet('World')").execute(new MapContext());
+            Assertions.assertEquals("Hello, World", result);
+        }
+    }
+
+    @Test
+    public void testUnrestrictedBase() throws Exception {
+        try (InputStream in = yaml("permissions:\n  base: UNRESTRICTED\n")) {
+            Assertions.assertNotNull(JexlConfigLoader.load(in).create());
+        }
+    }
+
+    @Test
+    public void testSecureBase() throws Exception {
+        try (InputStream in = yaml("permissions:\n  base: SECURE\n")) {
+            final JexlBuilder builder = JexlConfigLoader.load(in);
+            Assertions.assertSame(org.apache.commons.jexl3.introspection.JexlPermissions.SECURE,
+                builder.permissions());
+        }
+        // no base: → defaults to SECURE
+        try (InputStream in = yaml("permissions:\n  rules:\n")) {
+            final JexlBuilder builder = JexlConfigLoader.load(in);
+            // base is SECURE (default); no rules means same object
+            Assertions.assertNotNull(builder.permissions());
+        }
+    }
+
+    @Test
+    public void testMigrationYaml() throws Exception {
+        // jexl.yaml restores RESTRICTED permissions + legacy features (new, loops, side-effects)
+        try (InputStream in = resource("jexl.yaml")) {
+            final JexlEngine engine = JexlConfigLoader.load(in).create();
+            // loop works
+            final Number sum = (Number) engine.createScript(
+                "var s = 0; for (var i : [1,2,3]) { s += i; } s").execute(new MapContext());
+            Assertions.assertEquals(6, sum.intValue());
+            // new() works
+            final Object list = engine.createScript(
+                "new('java.util.ArrayList')").execute(new MapContext());
+            Assertions.assertNotNull(list);
+        }
+    }
+
+    @Test
+    public void testLoggingFromYaml() throws Exception {
+        // a named logger wraps the permissions in a logging view
+        try (InputStream in = yaml("permissions:\n  base: RESTRICTED\n  logging: jexl.config.permissions\n")) {
+            final JexlBuilder builder = JexlConfigLoader.load(in);
+            Assertions.assertTrue(builder.permissions()
+                instanceof org.apache.commons.jexl3.introspection.JexlPermissions.LoggingPermissions);
+        }
+        // a bare "logging:" entry uses the default logger, still a logging view
+        try (InputStream in = yaml("permissions:\n  base: RESTRICTED\n  logging:\n")) {
+            Assertions.assertTrue(JexlConfigLoader.load(in).permissions()
+                instanceof org.apache.commons.jexl3.introspection.JexlPermissions.LoggingPermissions);
+        }
+        // without a logging entry, no wrapper is applied
+        try (InputStream in = yaml("permissions:\n  base: RESTRICTED\n")) {
+            Assertions.assertFalse(JexlConfigLoader.load(in).permissions()
+                instanceof org.apache.commons.jexl3.introspection.JexlPermissions.LoggingPermissions);
+        }
+    }
+}
diff --git a/src/test/java/org/apache/commons/jexl3/JexlTestCase.java b/src/test/java/org/apache/commons/jexl3/JexlTestCase.java
index bcee95bf..b81c447b 100644
--- a/src/test/java/org/apache/commons/jexl3/JexlTestCase.java
+++ b/src/test/java/org/apache/commons/jexl3/JexlTestCase.java
@@ -53,6 +53,9 @@ public class JexlTestCase {
   // important can be identified by the builder  calling lexical(...).
   static {
     JexlBuilder.setDefaultPermissions(TEST_PERMS);
+    // Keep the full permissive feature set so all test subclasses can use new(), loops, side-effects.
+    // The 3.7 hardened default is the correct library default; tests bring their own configuration.
+    JexlBuilder.setDefaultFeatures(JexlFeatures.createDefault());
     JexlOptions.setDefaultFlags("-safe", "+lexical");
     MODE_PRO50.setFlags("+strict +cancellable +lexical +lexicalShade -safe".split(" "));
   }
@@ -122,6 +125,7 @@ public class JexlTestCase {
   @BeforeAll
   static void setUpClass() {
     JexlBuilder.setDefaultPermissions(TEST_PERMS);
+    JexlBuilder.setDefaultFeatures(JexlFeatures.createDefault());
   }
 
   public String simpleWhitespace(final String arg) {
diff --git a/src/test/java/org/apache/commons/jexl3/LoggingPermissions.java b/src/test/java/org/apache/commons/jexl3/LoggingPermissions.java
deleted file mode 100644
index 4c5f064d..00000000
--- a/src/test/java/org/apache/commons/jexl3/LoggingPermissions.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.jexl3;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.logging.Logger;
-
-import org.apache.commons.jexl3.introspection.JexlPermissions;
-
-/**
- * A debugging class to determine what is allowed/denied.
- */
-public class LoggingPermissions extends JexlPermissions.Delegate {
-    private final Logger logger = Logger.getLogger(LoggingPermissions.class.getName());
-
-    /**
-     * Constructs a new instance.
-     *
-     * @param delegate the delegate.
-     */
-    public LoggingPermissions(final JexlPermissions delegate) {
-        super(delegate);
-    }
-
-    @Override
-    public boolean allow(final Class<?> clazz) {
-        final boolean allowed = super.allow(clazz);
-        logger.info(String.format("Class %s is %s",
-            clazz.getCanonicalName(), allowed ? "allowed" : "denied"));
-        return allowed;
-    }
-
-    @Override
-    public boolean allow(final Constructor<?> ctor) {
-        final boolean allowed = super.allow(ctor);
-        logger.info(String.format("Constructor %s.%s() is %s",
-            ctor.getDeclaringClass().getCanonicalName(), ctor.getName(),
-            allowed ? "allowed" : "denied"));
-        return allowed;
-    }
-
-    @Override
-    public boolean allow(final Field field) {
-        final boolean allowed = super.allow(field);
-        logger.info(String.format("Field %s.%s is %s",
-            field.getDeclaringClass().getCanonicalName(), field.getName(),
-            allowed ? "allowed" : "denied"));
-        return allowed;
-    }
-
-    @Override
-    public boolean allow(final Class<?> clazz, final Field field) {
-        final boolean allowed = super.allow(clazz, field);
-        logger.info(String.format("Field %s.%s is %s for class %s",
-            field.getDeclaringClass().getCanonicalName(), field.getName(),
-            allowed ? "allowed" : "denied", clazz.getCanonicalName()));
-        return allowed;
-    }
-
-    @Override
-    public boolean allow(final Method method) {
-        final boolean allowed = super.allow(method);
-        logger.info(String.format("Method %s.%s() is %s",
-            method.getDeclaringClass().getCanonicalName(), method.getName(),
-            allowed ? "allowed" : "denied"));
-        return allowed;
-    }
-
-    @Override
-    public boolean allow(final Class<?> clazz, final Method method) {
-        final boolean allowed = super.allow(clazz, method);
-        logger.info(String.format("Method %s.%s() is %s for class %s",
-            method.getDeclaringClass().getCanonicalName(), method.getName(),
-            allowed ? "allowed" : "denied", clazz.getCanonicalName()));
-        return allowed;
-    }
-}
diff --git a/src/test/java/org/apache/commons/jexl3/LoggingPermissionsTest.java b/src/test/java/org/apache/commons/jexl3/LoggingPermissionsTest.java
new file mode 100644
index 00000000..a46945cd
--- /dev/null
+++ b/src/test/java/org/apache/commons/jexl3/LoggingPermissionsTest.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.jexl3;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.List;
+
+import org.apache.commons.jexl3.introspection.JexlPermissions;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Tests for {@link JexlPermissions#logging(org.apache.commons.logging.Log)} and the
+ * {@code LoggingPermissions} wrapper: it must log what it allows/denies, but each decision only once.
+ */
+class LoggingPermissionsTest {
+
+    @Test
+    void testLoggingPermissionsCaptureAndDedup() throws Exception {
+        final CaptureLog log = new CaptureLog();
+        final JexlPermissions perms = JexlPermissions.RESTRICTED.logging(log);
+        // call each element twice to exercise the once-only logging
+        for (int i = 0; i < 2; i++) {
+            assertTrue(perms.allow(String.class));                     // allowed class
+            assertFalse(perms.allow(java.lang.Runtime.class));         // denied class
+            assertTrue(perms.allow(String.class.getMethod("length"))); // allowed method
+        }
+        final List<String> msgs = log.getCapturedMessages();
+        // Each distinct line is logged once despite two rounds (otherwise there would be 8 records).
+        // allow(Method) delegates through allow(Class, Method), so a single method check yields two
+        // distinct lines: the method-in-class form and the plain method form.
+        assertEquals(4, msgs.size(), msgs::toString);
+        assertEquals(4, log.count("info"));
+        assertTrue(msgs.contains("Class java.lang.String is allowed"));
+        assertTrue(msgs.contains("Class java.lang.Runtime is denied"));
+        assertTrue(msgs.contains("Method java.lang.String.length() is allowed"));
+        assertTrue(msgs.contains("Method java.lang.String.length() is allowed for class java.lang.String"));
+    }
+}
diff --git a/src/test/java/org/apache/commons/jexl3/internal/introspection/PermissionsTest.java b/src/test/java/org/apache/commons/jexl3/internal/introspection/PermissionsTest.java
index 4897deb8..1a8f0f4b 100644
--- a/src/test/java/org/apache/commons/jexl3/internal/introspection/PermissionsTest.java
+++ b/src/test/java/org/apache/commons/jexl3/internal/introspection/PermissionsTest.java
@@ -268,6 +268,108 @@ class PermissionsTest {
         assertFalse(p.allow(exit));
     }
 
+    @Test
+    void testParsePermissions0a2() {
+        // Deny-list package with partial class denial: Runtime is accessible, only exit()/exec() denied
+        final String src = "java.lang.*\njava.lang { Runtime { exit(); exec(); } }";
+        final Permissions p = (Permissions) JexlPermissions.parse(src);
+        assertTrue(p.allow(Runtime.class));
+        assertFalse(p.allow(getMethod(Runtime.class, "exit")));
+        assertTrue(p.allow(getMethod(Runtime.class, "availableProcessors")));
+    }
+
+    @Test
+    void testParsePermissions0b2() {
+        // Positive package: all classes allowed, but deny specific methods on Runtime
+        final String src = "java.lang +{ -Runtime { exit(); } }";
+        final Permissions p = (Permissions) JexlPermissions.parse(src);
+        assertTrue(p.allow(Runtime.class));
+        final Method exit = getMethod(Runtime.class, "exit");
+        assertNotNull(exit);
+        assertFalse(p.allow(exit));
+        final Method avp = getMethod(Runtime.class, "availableProcessors");
+        assertNotNull(avp);
+        assertTrue(p.allow(avp));
+        assertTrue(p.allow(String.class));
+    }
+
+    @Test
+    void testFormatterCtorDenied() throws Exception {
+        // positive package java.util, Formatter class accessible, only the constructor denied
+        final Constructor<?> ctor = java.util.Formatter.class.getConstructor();
+        assertNotNull(ctor);
+        assertFalse(RESTRICTED.allow(ctor));
+        final Method format = getMethod(java.util.Formatter.class, "format");
+        assertNotNull(format);
+        assertTrue(RESTRICTED.allow(format));
+        assertTrue(RESTRICTED.allow(java.util.Formatter.class));
+    }
+
+    @Test
+    void testPrintWriterCtorDenied() {
+        // negative package java.io, PrintWriter added as a positive class, only the constructor denied
+        for (final Constructor<?> ctor : java.io.PrintWriter.class.getDeclaredConstructors()) {
+            assertFalse(RESTRICTED.allow(ctor), () -> "should deny " + ctor);
+        }
+        final Method println = getMethod(java.io.PrintWriter.class, "println");
+        assertNotNull(println);
+        assertTrue(RESTRICTED.allow(println));
+        assertTrue(RESTRICTED.allow(java.io.PrintWriter.class));
+        // unlisted java.io class stays denied
+        assertFalse(RESTRICTED.allow(java.io.File.class));
+    }
+
+    @Test
+    void testForeignTypeRequiresExplicitAllow() {
+        // a foreign class must NOT be reachable just because a super-type is allowed (no reach-through):
+        // com.google.gson.internal.LinkedTreeMap extends java.util.AbstractMap but its own package is undeclared
+        assertFalse(RESTRICTED.allow(com.google.gson.internal.LinkedTreeMap.class));
+        // it becomes accessible only once its own package is explicitly allowed
+        final JexlPermissions allowed = RESTRICTED.compose("com.google.gson.internal +{}");
+        assertTrue(allowed.allow(com.google.gson.internal.LinkedTreeMap.class));
+        // a class in an undeclared sub-package of a declared package stays denied
+        assertFalse(RESTRICTED.allow(java.lang.annotation.ElementType.class));
+    }
+
+    @Test
+    void testPositivePackageNoSubPackageWildcard() {
+        // a positive package (java.util +{}) must not implicitly allow its sub-packages
+        assertFalse(RESTRICTED.allow(java.util.zip.ZipEntry.class));
+    }
+
+    @Test
+    void testSecureMinimum() throws Exception {
+        final JexlPermissions secure = JexlPermissions.SECURE;
+        // allowed: safe java.lang value types, java.math, java.util collections + their methods
+        assertTrue(secure.allow(String.class));
+        assertTrue(secure.allow(Integer.class));
+        assertTrue(secure.allow(java.util.ArrayList.class));
+        assertTrue(secure.allow(java.util.HashMap.class));
+        assertTrue(secure.allow(java.math.BigInteger.class));
+        assertTrue(secure.allow(getMethod(Integer.class, "intValue")));
+        assertTrue(secure.allow(getMethod(java.math.BigInteger.class, "bitLength")));
+        // Object: equals/hashCode/toString allowed, getClass denied
+        assertTrue(secure.allow(getMethod(Object.class, "toString")));
+        assertFalse(secure.allow(getMethod(Object.class, "getClass")));
+        // denied: dangerous java.lang, java.io, sub-packages, other base packages
+        assertFalse(secure.allow(System.class));
+        assertFalse(secure.allow(Runtime.class));
+        assertFalse(secure.allow(java.lang.Class.class));
+        assertFalse(secure.allow(java.io.File.class));
+        assertFalse(secure.allow(java.util.zip.ZipEntry.class));
+        assertFalse(secure.allow(java.time.LocalDate.class));
+    }
+
+    @Test
+    void testRangeIteratesUnderRestrictedAndSecure() {
+        // ranges are a language primitive and must iterate even under the tightest permissions
+        for (final JexlPermissions p : new JexlPermissions[] { RESTRICTED, JexlPermissions.SECURE }) {
+            final JexlEngine jexl = new JexlBuilder().permissions(p).create();
+            final Object r = jexl.createScript("var s = 0; for (var i : 1..3) { s += i; } s").execute(null);
+            assertEquals(6, ((Number) r).intValue(), () -> "range should iterate under " + p);
+        }
+    }
+
     @Test
     void testParsePermissions0c() {
         final String src = "java.lang { +Runtime { availableProcessorCount(); } }";
diff --git a/src/test/java/org/apache/commons/jexl3/scripting/JexlScriptEngineTest.java b/src/test/java/org/apache/commons/jexl3/scripting/JexlScriptEngineTest.java
index 8c9e9faf..0a6386cf 100644
--- a/src/test/java/org/apache/commons/jexl3/scripting/JexlScriptEngineTest.java
+++ b/src/test/java/org/apache/commons/jexl3/scripting/JexlScriptEngineTest.java
@@ -46,7 +46,6 @@ import javax.script.ScriptEngineManager;
 import javax.script.ScriptException;
 
 import org.apache.commons.jexl3.JexlException;
-import org.apache.commons.jexl3.LoggingPermissions;
 import org.apache.commons.jexl3.introspection.JexlPermissions;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
@@ -72,10 +71,13 @@ class JexlScriptEngineTest {
 
     private static final String LF = System.lineSeparator();
 
+    /** The logger name used by the LoggingPermissions wrapper in this test. */
+    private static final String PERMS_LOGGER = "jexl.test.permissions";
+
     @BeforeEach
     void setUp() {
-        // quiesce LoggingPermissions logging, set level to error (instead of info)
-        java.util.logging.Logger.getLogger(LoggingPermissions.class.getName()).setLevel(java.util.logging.Level.SEVERE);
+        // quiesce the LoggingPermissions logger, set level to error (instead of info)
+        java.util.logging.Logger.getLogger(PERMS_LOGGER).setLevel(java.util.logging.Level.SEVERE);
     }
 
     @AfterEach
@@ -198,9 +200,9 @@ class JexlScriptEngineTest {
     void testScriptEngineFactory() {
         final JexlScriptEngineFactory factory = new JexlScriptEngineFactory();
         assertEquals("JEXL Engine", factory.getParameter(ScriptEngine.ENGINE));
-        assertEquals("3.6", factory.getParameter(ScriptEngine.ENGINE_VERSION));
+        assertEquals("3.7", factory.getParameter(ScriptEngine.ENGINE_VERSION));
         assertEquals("JEXL", factory.getParameter(ScriptEngine.LANGUAGE));
-        assertEquals("3.6", factory.getParameter(ScriptEngine.LANGUAGE_VERSION));
+        assertEquals("3.7", factory.getParameter(ScriptEngine.LANGUAGE_VERSION));
         assertNull(factory.getParameter("THREADING"));
         assertEquals(NAMES, factory.getParameter(ScriptEngine.NAME));
         assertEquals(EXTENSIONS, factory.getExtensions());
@@ -267,13 +269,13 @@ class JexlScriptEngineTest {
     @Test
     void testScriptingPermissions1() throws Exception {
         // shows what is required to access System.currentTimeMillis()
-        JexlScriptEngineFactory.setDefaultPermissions(new LoggingPermissions(
+        JexlScriptEngineFactory.setDefaultPermissions(
             JexlPermissions.RESTRICTED.compose(
                 "javax.script { +SimpleScriptContext { getClass(); } }"
                     + "java.lang { "
                     + "+System { currentTimeMillis(); }"
                     + "+Class { forName(); } "
-                    + "}")));
+                    + "}").logging(PERMS_LOGGER));
         final ScriptEngineManager manager = new ScriptEngineManager();
         final ScriptEngine engine = manager.getEngineByName("jexl3");
         final Long time2 = (Long) engine.eval(
diff --git a/src/test/resources/org/apache/commons/jexl3/jexl.yaml b/src/test/resources/org/apache/commons/jexl3/jexl.yaml
new file mode 100644
index 00000000..03bf2f9e
--- /dev/null
+++ b/src/test/resources/org/apache/commons/jexl3/jexl.yaml
@@ -0,0 +1,69 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Migration recipe for JEXL 3.7.0
+#
+# JEXL 3.7 changed the default permissions to SECURE and the default features to disable
+# new(), global side-effects, pragmas, and annotations (and to enable lexical scoping).  If
+# your application relied on the previous defaults (RESTRICTED permissions + the pre-3.7
+# feature set), load this file via JexlConfigLoader to restore them:
+#
+#   try (InputStream in = getClass().getResourceAsStream("/jexl.yaml")) {
+#       JexlEngine engine = JexlConfigLoader.load(in).create();
+#   }
+#
+# See JexlPermissions.logging() to discover which reflective elements the new
+# algorithm denies under your workload.
+#
+# Every flag is set explicitly so this recipe is immune to any future change of the
+# library defaults: the features below reproduce JexlFeatures.createDefault() (the
+# pre-3.7 effective feature set) exactly.
+
+permissions:
+  base: RESTRICTED
+
+features:
+  # Script structure
+  script: true
+  localVar: true
+  lambda: true
+  loops: true
+  newInstance: true
+  # Side-effects
+  sideEffect: true
+  sideEffectGlobal: true
+  # Literals and operators
+  structuredLiteral: true
+  arrayReferenceExpr: true
+  methodCall: true
+  annotation: true
+  pragma: true
+  pragmaAnywhere: true
+  namespacePragma: true
+  importPragma: true
+  namespaceIdentifier: false
+  # Lambda arrow styles
+  thinArrow: true
+  fatArrow: false
+  # Variable capture semantics
+  constCapture: false
+  referenceCapture: false
+  # Lexical scoping
+  lexical: false
+  lexicalShade: false
+  # Misc
+  comparatorNames: true
+  ambiguousStatement: false
+  ignoreTemplatePrefix: false
diff --git a/src/test/resources/org/apache/commons/jexl3/test-config.yaml b/src/test/resources/org/apache/commons/jexl3/test-config.yaml
new file mode 100644
index 00000000..6d5ed475
--- /dev/null
+++ b/src/test/resources/org/apache/commons/jexl3/test-config.yaml
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+strict: true
+safe: false
+silent: false
+cache: 128
+stackOverflow: 100
+
+permissions:
+  base: RESTRICTED
+
+namespaces:
+  math: java.lang.Math
+
+features:
+  loops: true
+  lambda: true
+  sideEffect: true