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
85 scanned, 38 skipped (binary, oversized, or unrecognised)
Signals
1 critical · 0 warn · 22 info
Scan time
15.9 s
LLM review
Reviewed by claude-haiku-5-5 (Anthropic): 23 of 23 warn and critical signals; 22 demoted to info.
Disclude version
4.0.0
Scanned (UTC)
2026-10-14 18:40

Signals

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

  1. critical 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:
    inconclusive LLM, confidence 0.80 Module-level exec generating a test class from a formatted template string.
    Reasoning

    Module-scope exec in a test file builds a class from a template string with %s formatting; it runs on import of the test module, which is unusual and worth a glance, but the content appears to be a generated test class with no network or shell activity visible.

  2. 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 Helper that parses a template expression string into an AST node via compile().
    Reasoning

    compile() with PyCF_ONLY_AST is the standard way to parse a Python expression into an AST in a template engine. The expression comes from template source the developer controls, so this is expected behavior, not obfuscation.

  3. 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 template def/block tag during code generation.
    Reasoning

    Mako's code generator evaluates tag attributes such as buffered and cached, which are simple boolean literals written in the template. Templates are already trusted code in this library, so the eval is a known design choice rather than malicious intent.

  4. 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 template tag during code generation.
    Reasoning

    Same pattern as the neighboring eval calls: a template tag attribute with a default of "False" is evaluated during code generation. This is an expected template-engine mechanism.

  5. 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 the cached attribute of a page tag during code generation.
    Reasoning

    Evaluates the cached attribute of a page tag to set code-generation flags. Consistent with Mako's attribute handling; the input is template-author supplied.

  6. 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 the enable_loop attribute of a page tag during code generation.
    Reasoning

    Evaluates the enable_loop attribute of a page tag, a boolean literal supplied in the template. This is ordinary template-compiler behavior.

  7. 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. The value is a template-supplied boolean literal, so this is expected behavior in a template compiler.

  8. 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 template tag during code generation.
    Reasoning

    Evaluates the buffered attribute of a template tag during code generation, the same pattern as other tag-attribute evals in this file.

  9. 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 template tag during code generation.
    Reasoning

    Evaluates the cached attribute of a template tag during code generation, consistent with the rest of the compiler's attribute handling.

  10. 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.80 Evaluates the cache timeout argument during code generation before converting it to int.
    Reasoning

    Evaluates a cache timeout attribute and wraps it in int(). The input comes from template cache arguments, so this is a legitimate, if loose, template-compiler design choice. The eval is a minor trust-boundary concern only if templates are untrusted.

  11. 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 to resolve a template namespace.
    Reasoning

    __import__ resolves a module name taken from template namespace/import declarations, which is how Mako loads template namespaces. The module is chosen by the template author, so this is expected. The critical severity reflects the dynamic import, not a sign of malicious payload here.

  12. 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 code object.
    Reasoning

    Compiling template source to a code object is the core function of Mako, which turns templates into Python modules. The source is the template being rendered, so this is the intended design, not a supply-chain payload.

  13. 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 code to populate the module namespace.
    Reasoning

    exec runs the compiled template module into its namespace, which is the purpose of a template engine. The code is generated from the template, and the flag reflects the expected dynamic execution in this library.

  14. 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.90 Dynamic module import via __import__ in a helper that resolves a dotted module path.
    Reasoning

    __import__ on a module path inside a load() helper is the standard lazy-import idiom used by Mako to load template-referenced modules; the path comes from configuration, not untrusted input in this snippet.

  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"]
    likely benign LLM, confidence 0.90 eval of test expressions to check AST round-tripping in a unit test.
    Reasoning

    eval inside a test comparing original and regenerated Python expressions over fixed test code; this is a test harness pattern, not an attack.

  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"]
    likely benign LLM, confidence 0.90 Second eval in the same round-trip equality assertion within a unit test.
    Reasoning

    Same test assertion comparing evaluated results of original and generated code; benign test harness.

  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 used in an AST expression-equivalence test.
    Reasoning

    Repeated round-trip evaluation assertion in test code with fixed local_dict fixtures; benign.

  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 Second eval in the AST equivalence test assertion.
    Reasoning

    Same benign test assertion comparing evaluation results with a fixed fixture dictionary.

  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 over a list of test code strings in an AST round-trip test.
    Reasoning

    Loop over fixed code samples evaluated for equality in a test; no 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 Second eval in the looped AST round-trip test.
    Reasoning

    Same benign loop evaluation in test code.

  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 within a conditional branch of an AST equivalence test.
    Reasoning

    Test assertion evaluating fixed test code strings; benign test harness.

  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 Second eval in the conditional AST equivalence test.
    Reasoning

    Second benign eval in the same test assertion.

  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 whether generated source raises SyntaxError.
    Reasoning

    compile is used to check whether a template model is valid Python, catching SyntaxError; this is syntax validation in exception-handling tests, not execution.

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.0.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 .