Uploaded image for project: 'Commons JEXL'
  1. Commons JEXL
  2. JEXL-243

Allow restricting available features in Script/Expressions

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1
    • 3.2
    • None

    Description

      Restrict features related to potential dangers/difficulties one may encounter whilst scripting;

      Reserved Names: a set of reserved variable names that can not be used as local variable (or parameter) names
      Registers: boolean property allowing parsing of register syntax (#number)
      Global Side Effect : boolean property controlling assigning/modifying values on global variables
      Side Effect: boolean property controlling side effects assigning/modifying values on any variable
      New Instance: boolean property controlling creating new instances through new(...) or using class as functor
      Loops: boolean property controlling usage of loop constructs (while(true), for(...))
      Lambda: boolean property controlling usage of script function declarations

      Attachments

        Issue Links

          Activity

            henrib Henri Biestro added a comment -

            First drop:

            src/main/java/org/apache/commons/jexl3/JexlBuilder.java
            src/main/java/org/apache/commons/jexl3/JexlEngine.java
            src/main/java/org/apache/commons/jexl3/JexlException.java
            src/main/java/org/apache/commons/jexl3/JexlFeatures.java
            src/main/java/org/apache/commons/jexl3/internal/Engine.java
            src/main/java/org/apache/commons/jexl3/parser/JexlNode.java
            src/main/java/org/apache/commons/jexl3/parser/JexlParser.java
            src/main/java/org/apache/commons/jexl3/parser/Parser.jjt
            /src/test/java/org/apache/commons/jexl3/FeaturesTest.java
            src/test/java/org/apache/commons/jexl3/parser/ParserTest.java

            Committed revision 1813544.

            henrib Henri Biestro added a comment - First drop: src/main/java/org/apache/commons/jexl3/JexlBuilder.java src/main/java/org/apache/commons/jexl3/JexlEngine.java src/main/java/org/apache/commons/jexl3/JexlException.java src/main/java/org/apache/commons/jexl3/JexlFeatures.java src/main/java/org/apache/commons/jexl3/internal/Engine.java src/main/java/org/apache/commons/jexl3/parser/JexlNode.java src/main/java/org/apache/commons/jexl3/parser/JexlParser.java src/main/java/org/apache/commons/jexl3/parser/Parser.jjt /src/test/java/org/apache/commons/jexl3/FeaturesTest.java src/test/java/org/apache/commons/jexl3/parser/ParserTest.java Committed revision 1813544.
            dmitri_blinov Dmitri Blinov added a comment - - edited

            Well, this basically works, the only thing is what if I have in one framework two different types of scripts, say scripts with side effects and scripts without side effects (or better to name them getters and setters). Those types of scripts are supposed to use a single Jexl engine instance. It would be more practical to be able to specify desired features right to JexlEngine.createScript() method. Maybe JexlEngine.createExpression() should get such an overload too, but maybe it's even better, not to speak of backward compatibility now, to have the only one JexlEngine.createScript() which could create both "scripts" and "expressions" by simply specifying "right" feature sets in each case.

            dmitri_blinov Dmitri Blinov added a comment - - edited Well, this basically works, the only thing is what if I have in one framework two different types of scripts, say scripts with side effects and scripts without side effects (or better to name them getters and setters). Those types of scripts are supposed to use a single Jexl engine instance. It would be more practical to be able to specify desired features right to JexlEngine.createScript() method. Maybe JexlEngine.createExpression() should get such an overload too, but maybe it's even better, not to speak of backward compatibility now, to have the only one JexlEngine.createScript() which could create both "scripts" and "expressions" by simply specifying "right" feature sets in each case.
            henrib Henri Biestro added a comment -

            Also added pragma, annotation and structured literals (set, map, array, list, ranges).

            src/main/java/org/apache/commons/jexl3/internal/ScriptVisitor.java
            src/main/java/org/apache/commons/jexl3/parser/FeatureController.java
            src/main/java/org/apache/commons/jexl3/internal/Source.java
            RELEASE-NOTES.txt
            src/main/java/org/apache/commons/jexl3/JexlBuilder.java
            src/main/java/org/apache/commons/jexl3/JexlEngine.java
            src/main/java/org/apache/commons/jexl3/JexlFeatures.java
            src/main/java/org/apache/commons/jexl3/internal/Debugger.java
            src/main/java/org/apache/commons/jexl3/internal/Engine.java
            src/main/java/org/apache/commons/jexl3/internal/Interpreter.java
            src/main/java/org/apache/commons/jexl3/internal/Script.java
            src/main/java/org/apache/commons/jexl3/internal/ScriptVisitor.java
            src/main/java/org/apache/commons/jexl3/internal/Source.java
            src/main/java/org/apache/commons/jexl3/internal/TemplateEngine.java
            src/main/java/org/apache/commons/jexl3/internal/TemplateScript.java
            src/main/java/org/apache/commons/jexl3/parser/ASTJexlScript.java
            src/main/java/org/apache/commons/jexl3/parser/FeatureController.java
            src/main/java/org/apache/commons/jexl3/parser/JexlParser.java
            src/main/java/org/apache/commons/jexl3/parser/Parser.jjt
            src/site/xdoc/changes.xml
            src/test/java/org/apache/commons/jexl3/ContextNamespaceTest.java
            src/test/java/org/apache/commons/jexl3/ExceptionTest.java
            src/test/java/org/apache/commons/jexl3/FeaturesTest.java
            src/test/java/org/apache/commons/jexl3/IfTest.java
            src/test/java/org/apache/commons/jexl3/IssuesTest200.java
            src/test/java/org/apache/commons/jexl3/JexlTest.java
            src/test/java/org/apache/commons/jexl3/PropertyAccessTest.java
            src/test/java/org/apache/commons/jexl3/internal/Util.java
            src/test/java/org/apache/commons/jexl3/parser/ParserTest.java

            Committed revision 1816640.

            henrib Henri Biestro added a comment - Also added pragma, annotation and structured literals (set, map, array, list, ranges). src/main/java/org/apache/commons/jexl3/internal/ScriptVisitor.java src/main/java/org/apache/commons/jexl3/parser/FeatureController.java src/main/java/org/apache/commons/jexl3/internal/Source.java RELEASE-NOTES.txt src/main/java/org/apache/commons/jexl3/JexlBuilder.java src/main/java/org/apache/commons/jexl3/JexlEngine.java src/main/java/org/apache/commons/jexl3/JexlFeatures.java src/main/java/org/apache/commons/jexl3/internal/Debugger.java src/main/java/org/apache/commons/jexl3/internal/Engine.java src/main/java/org/apache/commons/jexl3/internal/Interpreter.java src/main/java/org/apache/commons/jexl3/internal/Script.java src/main/java/org/apache/commons/jexl3/internal/ScriptVisitor.java src/main/java/org/apache/commons/jexl3/internal/Source.java src/main/java/org/apache/commons/jexl3/internal/TemplateEngine.java src/main/java/org/apache/commons/jexl3/internal/TemplateScript.java src/main/java/org/apache/commons/jexl3/parser/ASTJexlScript.java src/main/java/org/apache/commons/jexl3/parser/FeatureController.java src/main/java/org/apache/commons/jexl3/parser/JexlParser.java src/main/java/org/apache/commons/jexl3/parser/Parser.jjt src/site/xdoc/changes.xml src/test/java/org/apache/commons/jexl3/ContextNamespaceTest.java src/test/java/org/apache/commons/jexl3/ExceptionTest.java src/test/java/org/apache/commons/jexl3/FeaturesTest.java src/test/java/org/apache/commons/jexl3/IfTest.java src/test/java/org/apache/commons/jexl3/IssuesTest200.java src/test/java/org/apache/commons/jexl3/JexlTest.java src/test/java/org/apache/commons/jexl3/PropertyAccessTest.java src/test/java/org/apache/commons/jexl3/internal/Util.java src/test/java/org/apache/commons/jexl3/parser/ParserTest.java Committed revision 1816640.
            dmitri_blinov Dmitri Blinov added a comment -

            May be this is not the appropriate place to complain about git access, but for some reason I can not see your latest commit neither on github or via apache git repository at git://git.apache.org/commons-jexl.git, with two days have already passed...

            dmitri_blinov Dmitri Blinov added a comment - May be this is not the appropriate place to complain about git access, but for some reason I can not see your latest commit neither on github or via apache git repository at git://git.apache.org/commons-jexl.git, with two days have already passed...

            People

              henrib Henri Biestro
              henrib Henri Biestro
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: