PyPI / mako / 1.4.3

mako 1.4.3

Source
https://github.com/sqlalchemy/mako
Tag scanned
rel_1_4_3
Compared with
rel_1_4_2 (0 signals introduced since)
Files
108 scanned, 15 skipped (binary, oversized, or unrecognised)
Signals
0 critical · 0 warn · 24 info
Scan time
16.1 s
LLM review
Reviewed by claude-haiku-5-5 (Anthropic): 23 of 23 warn and critical signals; 23 demoted to info.
Disclude version
4.1.0
Scanned (UTC)
2026-10-22 04:09

Signals

Ordered by severity, then signals introduced in this release. Hidden characters are shown as ⟨U+…⟩.

  1. info warn → info by review dynamic-execution mako/_ast_util.py:89:12

    `compile` called on a non-literal expression (ast pass, confidence 0.70)

        """Parse an expression into an AST node."""
        return compile(expr, filename, mode, PyCF_ONLY_AST)
    likely benign LLM, confidence 0.90 Parses a template expression string into a Python AST node.
    Reasoning

    compile with PyCF_ONLY_AST is the standard way to parse a Python expression into an AST node. The expression comes from the template being compiled, so this is the templating engine's normal parsing step, not obfuscation or a dropper.

  2. info warn → info by review dynamic-execution mako/codegen.py:115:24

    `eval` called on a non-literal expression (ast pass, confidence 0.70)

                filtered = len(node.filter_args.args) > 0
                buffered = eval(node.attributes.get("buffered", "False"))
                cached = eval(node.attributes.get("cached", "False"))
                defs = None
    likely benign LLM, confidence 0.85 Evaluates the 'buffered' attribute of a def or block tag to a Python value.
    Reasoning

    eval is applied to a template tag attribute such as buffered="True" to turn it into a boolean. The input is the template author's own markup, and this is a known pattern in Mako's code generator. It is a code smell but not malicious.

  3. info warn → info by review dynamic-execution mako/codegen.py:116:22

    `eval` called on a non-literal expression (ast pass, confidence 0.70)

                buffered = eval(node.attributes.get("buffered", "False"))
                cached = eval(node.attributes.get("cached", "False"))
                defs = None
                pagetag = None
    likely benign LLM, confidence 0.85 Evaluates the 'cached' attribute of a tag during code generation.
    Reasoning

    Same pattern as the neighbouring eval calls: the attribute value comes from template source and is evaluated to a boolean during code generation. Nothing indicates attacker-controlled data reaching this at runtime.

  4. info warn → info by review dynamic-execution mako/codegen.py:129:26

    `eval` called on a non-literal expression (ast pass, confidence 0.70)

                        args += ["**pageargs"]
                    cached = eval(pagetag.attributes.get("cached", "False"))
                    self.compiler.enable_loop = self.compiler.enable_loop or eval(
                        pagetag.attributes.get("enable_loop", "False")
    likely benign LLM, confidence 0.85 Evaluates a page tag's 'cached' attribute during code generation.
    Reasoning

    Evaluates the cached attribute of a page tag at compile time. This is template-author input processed by the compiler, consistent with the rest of the codegen module.

  5. info warn → info by review dynamic-execution mako/codegen.py:130:74

    `eval` called on a non-literal expression (ast pass, confidence 0.70)

                    cached = eval(pagetag.attributes.get("cached", "False"))
                    self.compiler.enable_loop = self.compiler.enable_loop or eval(
                        pagetag.attributes.get("enable_loop", "False")
                    )
    likely benign LLM, confidence 0.85 Evaluates a page tag's 'enable_loop' attribute during code generation.
    Reasoning

    Evaluates the enable_loop attribute of a page tag at compile time. Template-author input only, consistent with the module's design.

  6. info warn → info by review dynamic-execution mako/codegen.py:439:16

    `eval` called on a non-literal expression (ast pass, confidence 0.70)

                    )
                if eval(node.attributes.get("inheritable", "False")):
                    self.printer.writeline("context['self'].%s = ns" % (node.name))
    likely benign LLM, confidence 0.85 Evaluates the 'inheritable' attribute of a def tag during code generation.
    Reasoning

    Evaluates the 'inheritable' attribute of a def tag to decide whether to emit a line of generated code. Input is template markup at compile time, so this is a benign compiler pattern.

  7. info warn → info by review dynamic-execution mako/codegen.py:609:20

    `eval` called on a non-literal expression (ast pass, confidence 0.70)

            filtered = len(node.filter_args.args) > 0
            buffered = eval(node.attributes.get("buffered", "False"))
            cached = eval(node.attributes.get("cached", "False"))
            self.printer.writelines(
    likely benign LLM, confidence 0.85 Evaluates the 'buffered' attribute of a block tag during code generation.
    Reasoning

    Evaluates the buffered attribute of a tag during code generation. Template-author input, benign compiler behavior.

  8. info warn → info by review dynamic-execution mako/codegen.py:610:18

    `eval` called on a non-literal expression (ast pass, confidence 0.70)

            buffered = eval(node.attributes.get("buffered", "False"))
            cached = eval(node.attributes.get("cached", "False"))
            self.printer.writelines(
                # push new frame, assign current frame to __M_caller
    likely benign LLM, confidence 0.85 Evaluates the 'cached' attribute of a block tag during code generation.
    Reasoning

    Evaluates the cached attribute of a block tag during code generation. Same benign template-compilation pattern.

  9. info warn → info by review dynamic-execution mako/codegen.py:723:41

    `eval` called on a non-literal expression (ast pass, confidence 0.70)

            if "timeout" in cache_args:
                cache_args["timeout"] = int(eval(cache_args["timeout"]))
    
            self.printer.writeline("def %s(%s):" % (name, ",".join(args)))
    likely benign LLM, confidence 0.85 Evaluates a cache timeout expression from a template tag to an integer.
    Reasoning

    Evaluates the cache timeout argument in template source to an int at compile time. Template-author input only, so this is a benign if unusual use of eval.

  10. info critical → info by review dynamic-import mako/runtime.py:662:15

    `__import__` called on a non-literal expression (ast pass, confidence 0.70)

    
            mod = __import__(module)
            for token in module.split(".")[1:]:
                mod = getattr(mod, token)
    likely benign LLM, confidence 0.80 Dynamically imports a module by name in the Mako runtime to resolve a reference.
    Reasoning

    __import__ loads a module named in the template's configuration or URI, followed by getattr traversal. This is how Mako's runtime resolves module references, and the critical severity reflects the signal type rather than a sign of malice. The residual doubt is that module names could come from untrusted input.

  11. info warn → info by review dynamic-execution mako/template.py:825:16

    `compile` called on a non-literal expression (ast pass, confidence 0.70)

        ):
            code = compile(source, cid, "exec")
    
            # the module body, which is the code of any <%! %> blocks, is
    likely benign LLM, confidence 0.90 Compiles generated template module source into a Python code object.
    Reasoning

    compile turns the generated Python module source into a code object. Compiling templates to Python bytecode is Mako's core function, and the source is produced by the engine itself.

  12. info warn → info by review dynamic-execution mako/template.py:832:9

    `exec` called on a non-literal expression (ast pass, confidence 0.70)

            # the module as one step
            exec(code, module.__dict__, module.__dict__)
    
        return (source, module)
    likely benign LLM, confidence 0.90 Executes the compiled template module to load it.
    Reasoning

    exec runs the compiled template module in its own namespace. This is the intended purpose of a template engine, which turns templates into executable modules. It is not a hidden payload.

  13. info critical → info by review dynamic-import mako/util.py:45:19

    `__import__` called on a non-literal expression (ast pass, confidence 0.70)

            def load():
                mod = __import__(modulepath)
                for token in modulepath.split(".")[1:]:
                    mod = getattr(mod, token)
    likely benign LLM, confidence 0.85 Lazily imports a module from a dotted path via a load helper.
    Reasoning

    __import__ loads a module from a modulepath string, then walks attributes to reach the target. This is a standard lazy-import helper for a library. The only risk is an untrusted modulepath, which is unlikely in this context.

  14. line length 902 characters (raw pass, confidence 0.50)

    <li>A dialog pops up. Fill in <em>all</em> the fields you can on the <tt class="docutils literal"><span class="pre">Project</span> <span class="pre">Info</span></tt> tab, enter the path to your project on the <tt class="docutils literal"><span class="pre">Paths</span></tt> tab (ie <tt class="docutils literal"><span cla
  15. info warn → info by review dynamic-execution test/test_ast.py:340:13

    `eval` called on a non-literal expression (ast pass, confidence 0.70)

            newcode = pyparser.ExpressionGenerator(astnode).value()
            eq_(eval(code, local_dict), eval(newcode, local_dict))
    
            a = ["one", "two", "three"]
    dismissed LLM, confidence 0.85 Evaluates original and regenerated expression code in a unit test.
    Reasoning

    This is a test asserting that a generated expression evaluates the same as the original. The eval runs on test fixtures, not on untrusted input.

  16. info warn → info by review dynamic-execution test/test_ast.py:340:37

    `eval` called on a non-literal expression (ast pass, confidence 0.70)

            newcode = pyparser.ExpressionGenerator(astnode).value()
            eq_(eval(code, local_dict), eval(newcode, local_dict))
    
            a = ["one", "two", "three"]
    dismissed LLM, confidence 0.85 Evaluates the regenerated expression in a unit test comparison.
    Reasoning

    Same test assertion as the adjacent eval call. It compares two fixture expressions in a unit test, so it is not an attack surface.

  17. info warn → info by review dynamic-execution test/test_ast.py:352:13

    `eval` called on a non-literal expression (ast pass, confidence 0.70)

            newcode = pyparser.ExpressionGenerator(astnode).value()
            eq_(eval(code, local_dict), eval(newcode, local_dict))
    
            local_dict = {"f": lambda: 9, "x": 7}
    likely benign LLM, confidence 0.90 eval of original and regenerated expression in an AST round-trip test.
    Reasoning

    Test comparing evaluation of original and regenerated Python expression code with a local dict; eval on test-generated expressions in a test suite is a normal pattern for verifying a code generator.

  18. info warn → info by review dynamic-execution test/test_ast.py:352:37

    `eval` called on a non-literal expression (ast pass, confidence 0.70)

            newcode = pyparser.ExpressionGenerator(astnode).value()
            eq_(eval(code, local_dict), eval(newcode, local_dict))
    
            local_dict = {"f": lambda: 9, "x": 7}
    likely benign LLM, confidence 0.90 eval of regenerated expression string in an AST round-trip test.
    Reasoning

    Same test assertion evaluating the regenerated code string; benign test harness comparing outputs of parsed and generated expressions.

  19. info warn → info by review dynamic-execution test/test_ast.py:358:13

    `eval` called on a non-literal expression (ast pass, confidence 0.70)

            newcode = pyparser.ExpressionGenerator(astnode).value()
            eq_(eval(code, local_dict), eval(newcode, local_dict))
    
            for code in [
    likely benign LLM, confidence 0.90 eval in a parameterized AST round-trip test loop.
    Reasoning

    Same round-trip test pattern over a list of literal test cases; eval is used to compare semantic equivalence, not to run untrusted input.

  20. info warn → info by review dynamic-execution test/test_ast.py:358:37

    `eval` called on a non-literal expression (ast pass, confidence 0.70)

            newcode = pyparser.ExpressionGenerator(astnode).value()
            eq_(eval(code, local_dict), eval(newcode, local_dict))
    
            for code in [
    likely benign LLM, confidence 0.90 eval of regenerated code in a test loop.
    Reasoning

    Same benign test assertion evaluating regenerated code within a test loop.

  21. info warn → info by review dynamic-execution test/test_ast.py:386:21

    `eval` called on a non-literal expression (ast pass, confidence 0.70)

                else:
                    eq_(eval(code, local_dict), eval(newcode, local_dict))
    likely benign LLM, confidence 0.90 eval comparing original and regenerated code in a test.
    Reasoning

    Repeated round-trip equivalence check in a test file; eval is a standard tool for comparing evaluation results in tests.

  22. info warn → info by review dynamic-execution test/test_ast.py:386:45

    `eval` called on a non-literal expression (ast pass, confidence 0.70)

                else:
                    eq_(eval(code, local_dict), eval(newcode, local_dict))
    likely benign LLM, confidence 0.90 eval of regenerated code in a test comparison.
    Reasoning

    Same benign test comparison of evaluated regenerated code.

  23. info warn → info by review dynamic-execution test/test_exceptions.py:471:17

    `compile` called on a non-literal expression (ast pass, confidence 0.70)

                try:
                    compile(model, "<test>", "exec")
                except SyntaxError:
                    return model
    likely benign LLM, confidence 0.85 compile call testing syntax validity of generated code in a test.
    Reasoning

    compile is used to check whether generated model source has a syntax error inside a test, returning the model on SyntaxError; this is a test utility with no malicious effect.

  24. info critical → info by review dynamic-execution test/test_lexer.py:61:9

    `exec` at module scope (runs on import) on a non-literal expression (ast pass, confidence 0.80)

            clsname = cls.__name__
            exec(
                ("""
    class %s:
    likely benign LLM, confidence 0.80 Module-level exec generating a class definition from a string template in a lexer test.
    Reasoning

    Module-scope exec building a class from a template in a test file is a common metaprogramming pattern for generating test classes; critical severity is overstated given it is test code with a generated template, though exec at import time warrants a glance at the template source.

Reproduce This Scan

Run disclude locally to verify. Add --format sarif for SARIF output. Add --llm (with an API key in the environment) to include the LLM review.

cargo install disclude --version 4.1.0
git clone https://github.com/sqlalchemy/mako mako && cd mako
git checkout rel_1_4_3
disclude scan --severity info --diff rel_1_4_2 .