PyPI / sqlalchemy / 2.1.5
sqlalchemy 2.1.5
- Source
- https://github.com/sqlalchemy/sqlalchemy
- Tag scanned
rel_2_1_5- Compared with
rel_2_1_4(0 signals introduced since)- Files
- 879 scanned, 17 skipped (binary, oversized, or unrecognised)
- Signals
- 0 critical · 0 warn · 46 info
- Scan time
- 40.3 s
- LLM review
- Reviewed by claude-haiku-5-5 (Anthropic): 42 of 42 warn and critical signals; 42 demoted to info.
- Disclude version
- 4.1.0
- Scanned (UTC)
- 2026-10-22 00:29
Signals
Ordered by severity, then signals introduced in this release. Hidden characters are shown as ⟨U+…⟩.
-
passlikely benign Dynamically imports example profiler modules by name.Reasoning
Imports a module named from a runtime string built from the package name and a discovered name, inside a try/except ImportError. This is the usual plugin-discovery pattern for example modules, with nothing fetched from outside or hidden.
-
likely benign Imports the selected example module from a CLI argument.
Reasoning
Same pattern as the sibling finding: it imports the module named by a command-line argument under the package. It is a developer-facing example runner with no obfuscation.
-
= . =likely benign Loads a SQLAlchemy dialect module by name.Reasoning
Loads a dialect package by name from the sqlalchemy.dialects namespace, then falls back when ImportError occurs. This is the standard SQLAlchemy dialect plugin loader, restricted to its own package.
-
= ..likely benign Loads the MariaDB driver dialect module by driver name.Reasoning
Imports a MySQL driver submodule under sqlalchemy.dialects.mysql using a driver string. It is a standard dialect loader inside the library's own namespace.
-
info
critical→ info by reviewdynamic-importlib/sqlalchemy/dialects/mysql/mariadbconnector.py:210:32= ..likely benign Reads CLIENT flag constants from the MariaDB connector module.Reasoning
Imports the constants submodule of the DBAPI module the user already loaded, then reads CLIENT flags, inside a guarded try. This is routine compatibility code.
-
= ..likely benign Reads CLIENT flag constants from the mysqlclient DBAPI module.Reasoning
Same constants-import compatibility pattern as the mariadbconnector finding, derived from the loaded DBAPI module name, with no hidden behavior.
-
passlikely benign Optionally imports a package's provision submodule.Reasoning
Imports an optional provision submodule of the given package and ignores ImportError. This is the optional test-provisioning hook pattern.
-
# establish pickle capability by adding it to this module =likely benign Registers a generated class in module globals for pickling.Reasoning
Registers a class in module globals so pickle can find it, as the comment states. This is a common, documented technique for pickle support.
-
=likely benign Evaluates developer-supplied declarative expression strings.Reasoning
eval runs a string argument, such as a relationship expression supplied by the developer in model declarations, against restricted namespaces. It is an intentional, documented ORM feature, though eval on strings is a dynamic-execution pattern worth noting.
-
) =likely benign Publishes a generated Annotated class into module globals.Reasoning
Assigns a generated Annotated class into module globals by name, which is a standard way to make generated classes importable and picklable. Nothing suggests hiding.
-
= =likely benign Dispatches coercion implementations via module-global lookup.Reasoning
Looks up a class by name in module globals to build a coercion implementation. This is internal registry dispatch, not hidden behavior.
-
= =likely benign Executes generated code to rebuild lambda closure cells.Reasoning
exec runs code generated internally from lambda closure cell values to rebuild closures, a known performance technique. The code is produced by the library rather than taken from outside input.
-
= yieldlikely benign Imports a dialect module for test engine setup.Reasoning
Imports a dialect module by name inside the SQLAlchemy test engine helper, which is expected in test tooling.
-
= . = =likely benign Finds the caller's directory to locate mypy test fixtures.Reasoning
Uses inspect.stack to find the caller's file path so tests can locate fixture files. This is a common test-helper technique with no evasion.
-
# late = =likely benign Imports a test module by dotted name and walks its attributes.Reasoning
Imports a module from a name in the testing plugin, then walks its attributes. This is standard test plugin loading.
-
# in format_argpsec_plus() returnlikely benign Execs generated source to create a function with a matching signature.Reasoning
exec builds a function from generated source for a signature-preserving wrapper, as the comment indicates. This is a common decorator-generation technique within the library.
-
= passlikely benign Reads the caller's module name via sys._getframe in a testing helper.Reasoning
sys._getframe(1) reads the caller's module name to set a default __module__ on a test schema object. It is a routine introspection idiom and the call is guarded by try/except. Nothing here is hidden or malicious.
-
, , , =, -
, =, ) -
= = -
= = -
= =likely benign Compiles generated wrapper source code for a decorator helper.Reasoning
This is the standard decorator-generation pattern: source text for a wrapper function is built from a signature, compiled with a real filename, cached in linecache, and exec'd. SQLAlchemy uses it to produce signature-preserving wrappers. It is a legitimate code-generation idiom, not obfuscation.
-
=likely benign Executes generated wrapper source to produce a function object.Reasoning
This exec runs the code object compiled from generated wrapper source in a fresh namespace and then pulls out the named function. It is the second half of the same legitimate code-generation helper.
-
= =likely benign Lazily imports a module from a dotted path string.Reasoning
This is a lazy dotted-path loader that imports a module named by a string and walks attributes to reach the target. It is a documented utility for deferred imports. The module path comes from library code, not from untrusted input.
-
= # being called from less than 3 (or given) stacklevels, weird,likely benign Inspects the caller stack frame to attribute a warning location.Reasoning
sys._getframe(stacklevel) is used by the deprecation-warning helper to attribute warnings to the correct caller. The critical severity comes only from the file also containing sys.exit or exec, which is normal for a library this size. There is no anti-analysis behavior.
-
= returnlikely benign Executes generated source to build a helper function.Reasoning
This exec runs generated source text in a namespace built from locals and returns a set function from it. It is the same kind of compatibility or code-generation helper seen elsewhere in this file.
-
) and not in : = =likely benign Lazily imports a named module on first attribute access.Reasoning
This is a lazy module loader that imports a named module on first attribute access and caches it in the instance and globals. It is a standard deferred-import pattern for avoiding circular imports.
-
= =likely benign Caches a lazily imported module into globals and the instance dict.Reasoning
The globals() lookup is the cache write-back that follows the lazy import on the line above. It stores the loaded module under its key. It is part of the same ordinary lazy-loading mechanism.
-
= =likely benign Evaluates a string type annotation within class namespaces.Reasoning
eval resolves string type annotations (for example forward references) against the class and module namespaces. This is the expected behavior of typing-introspection code. The input is annotation text from source code, not attacker-controlled runtime data.
-
=likely benign Evaluates a string annotation against base module globals as a fallback.Reasoning
This is the fallback branch of the same annotation resolver, evaluating the string against the base module globals. It is ordinary typing-introspection code.
-
= returnlikely benign Executes a test snippet in a scratch scope to obtain typed variables.Reasoning
This test helper execs a snippet of source to define variables for typing tests. It is confined to the test suite and uses a local scope dict. Nothing suggests hidden or malicious behavior.
-
= =likely benign Compiles the repo's own bootstrap.py file at conftest import time.Reasoning
The conftest reads bootstrap.py from the repository's own test directory and compiles it. This is the usual bootstrap for the SQLAlchemy pytest plugin. The path comes from the repo, not from a remote or encoded source. The critical rating reflects the module-scope exec, not hidden content.
-
= # noqalikely benign Executes the local bootstrap code to set up the pytest plugin.Reasoning
This exec runs the locally compiled bootstrap.py to load the pytest plugin. It is a known test-harness pattern in this project. The source is a local file in the repo, which is the main thing to check for supply-chain concerns, and it appears ordinary.
-
# test that repr() copies out all argumentslikely benign Evaluates the repr of a MySQL type instance to check round-trip output.Reasoning
eval is applied to a repr() of a type instance that is constructed in the test itself, so the input is trusted and controlled. It is a common round-trip test for repr output.
-
= ..likely benign Dynamically imports the psycopg errors module for version compatibility.Reasoning
This dynamically imports the psycopg errors submodule to pick the right exception class for the installed driver version. It is a standard compatibility shim, and the module name comes from the driver's own __name__.
-
= ..likely benign Dynamically imports the psycopg extensions module for version compatibility.Reasoning
This is the psycopg2 branch of the same compatibility shim, importing the extensions submodule via the driver's __name__. It is benign driver-version handling.
-
returnlikely benign Dynamic import of SQLAlchemy dialect modules in a test helper.Reasoning
The __import__ call builds a module name from a loop over the package's own dialects.__all__ list, filtered to skip names starting with an underscore. The input is a fixed internal list, not attacker-controlled data, which is a standard way to load dialect modules in a test suite.
-
):likely benign exec of a templated dialect import inside a connection-parsing test.Reasoning
The exec string is a fixed template that imports a dialect module by name and instantiates its dialect class. The name comes from the test's own parameter list, so this is test scaffolding for URL parsing and not a payload.
-
likely benign Test exec of operator expressions, flagged by the decoder-plus-exec heuristic.
Reasoning
The exec strings are built from a fixed set of comparison operators in a test that checks operator behaviour on association proxies. The pickle import co-occurs with this test scaffolding, not with any decode-then-run chain. The multi-stage flag is a heuristic false positive here.
-
likely benign exec of a formatted operator expression in an association proxy test.
Reasoning
The same exec of an operator-template string, where op is drawn from a fixed test list. It is generated test code with no external input.
-
likely benign exec of a formatted comparison in an association proxy test.
Reasoning
This exec runs a formatted expression built from a fixed operator in a test loop. No untrusted input reaches it.
-
return ,likely benign exec of locally generated class source in an ORM inspection test.Reasoning
The exec runs generated class-definition code inside a test helper that builds a mapped class with a given name and returns its names. The code is produced locally by the test, so this is dynamic class creation for testing.
-
likely benign os.system call to open a profiling output file with the runsnake viewer.
Reasoning
This is a performance script that optionally launches the local runsnake profile viewer on a file the script itself produced. Shell invocation with a formatted filename is ordinary for a developer benchmark tool and gated by a command-line flag, not a dropper.
-
= =likely benign exec of test-generated code to build a lambda statement generator.Reasoning
The exec compiles a code string from the test into a dict namespace to produce a lambda statement generator. This is a typical way to test lambda SQL construction, and the source is test-controlled.
-
# the repr round tripslikely benign eval of a repr round trip in a metadata test, flagged by the decoder-plus-eval heuristic.Reasoning
The pickle import sits in a file that also uses eval on repr(fk) to check a round trip for a ForeignKey object. The decoder-plus-eval heuristic fires on a repr round-trip test, which has no decoded or fetched payload.
-
# the repr round tripslikely benign eval of a ForeignKey repr in a metadata round-trip test.Reasoning
eval(repr(fk)) is a deliberate round-trip assertion on a schema object within a unit test. The input is the object's own repr, not external data.
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.
&&