Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5277

SecureASTCustomizer doesn't check class methods

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.8.4, 1.8.5, 2.0-beta-2
    • 1.8.6, 2.0-beta-3
    • GroovyScriptEngine
    • None
    • does not matter

    Description

      The "call" - method in SecureASTCustomzer doesn't check class methods content
      Instead of

        BlockStatement bstmt = ast.getStatementBlock();
        bstmt.visit(new SecuringCodeVisitor());
      

      should be:

       BlockStatement bstmt = ast.getStatementBlock();
              SecuringCodeVisitor visitor = new SecuringCodeVisitor();
              bstmt.visit(visitor);
              for (ClassNode clNode : ast.getClasses()) {
                  for ( MethodNode methodNode : clNode.getMethods()) {
                      if (methodNode.getCode() instanceof BlockStatement) {
                          BlockStatement blst = (BlockStatement) methodNode.getCode();
                          blst.visit(visitor);
                      }
                  }
      

      Attachments

        Activity

          People

            melix Cédric Champeau
            michael971 Michael Raschkowski
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: