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
- 37.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.0.0
- Scanned (UTC)
- 2026-10-17 00:42
Signals
Ordered by severity, then signals introduced in this release. Hidden characters are shown as ⟨U+…⟩.
-
passlikely benign Dynamic import of a sibling example module by constructed name.Reasoning
Dynamic __import__ of a module name built from a loop variable inside an example profiler package. It loads sibling modules by name in a test/example harness, a common plugin pattern with no sign of obfuscation or malicious intent.
-
likely benign Dynamic import of a profiler module selected by CLI argument.
Reasoning
Imports a named profiler module chosen from a command-line argument. This is a developer-facing example script; the input is local and the pattern is ordinary plugin loading.
-
= . =likely benign Loads a database dialect module by name within SQLAlchemy.Reasoning
Standard SQLAlchemy dialect loader that imports sqlalchemy.dialects.<name> for a configured dialect name. This is the documented plugin mechanism of the library.
-
= ..likely benign Loads the MariaDB driver dialect module by driver name.Reasoning
Driver-specific dialect loader that imports a fixed sqlalchemy.dialects.mysql submodule by driver name. Ordinary library code.
-
info
critical→ info by reviewdynamic-importlib/sqlalchemy/dialects/mysql/mariadbconnector.py:210:32= ..likely benign Imports the DBAPI constants module to read client flags.Reasoning
Imports the constants module of the already-loaded DBAPI object's package to read CLIENT flags. Uses the dbapi's own __name__, so it is a routine compatibility shim.
-
= ..likely benign Imports the MySQLdb constants module to read client flags.Reasoning
Same DBAPI constants lookup as the mariadbconnector dialect, derived from the loaded dbapi module name. Routine library code.
-
passlikely benign Optionally imports a package's provisioning module.Reasoning
Optional import of a package's provision submodule inside a try/except ImportError, used by the test provisioning framework. Ordinary optional-module loading.
-
# establish pickle capability by adding it to this module =likely benign Registers a class in module globals so it can be pickled.Reasoning
The comment states the purpose is to make classes picklable by registering them in module globals. This is a well-known Python idiom, not concealment.
-
=likely benign Evaluates ORM relationship expression strings against the class registry.Reasoning
eval of a string argument in a restricted namespace resolves ORM class-name expressions in relationship strings. It is a documented SQLAlchemy feature and the input comes from developer-authored model code, not untrusted data.
-
) =likely benign Registers a generated annotated class in module globals.Reasoning
Registers a generated Annotated<ClassName> class in module globals so it can be pickled. Standard metaprogramming in the library.
-
= =likely benign Instantiates a coercion implementation class looked up in globals.Reasoning
Looks up a coercion implementation class by name in module globals and instantiates it. Internal registry dispatch with no external input.
-
= =likely benign Executes generated code to construct closure cells for lambda statements.Reasoning
exec of internally generated code that builds closure cells for lambda caching. The code is generated from fixed templates over internal values, so this is a known library technique rather than hidden payload execution.
-
= yieldlikely benign Imports a dialect module by name for test engine setup.Reasoning
Imports a dialect test module by name inside the testing engine helper. Ordinary test-infrastructure code.
-
= . = =likely benign Reads the caller's file path via stack inspection in a test fixture.Reasoning
Uses inspect.stack to find the caller's file path so tests can locate files relative to it. Common and benign in test fixtures.
-
# late = =likely benign Dynamically imports a test plugin module by dotted name.Reasoning
Imports a module from a dotted name in the test plugin and walks its attributes. Standard dynamic loading in pytest plugin code.
-
# in format_argpsec_plus() returnlikely benign Execs generated code to create a function with a given signature for tests.Reasoning
exec builds a function with a matching signature for test argument formatting, using code produced internally by the library. This is a known pattern for generating wrappers in test tooling.
-
= passlikely benign Reads caller's module name via frame introspection in SQLAlchemy testing schema helper.Reasoning
sys._getframe(1) to read the caller's __name__ is a common idiom for determining the calling module in test schema helpers; no suspicious use.
-
, , , =, -
, =, ) -
= = -
= = -
= =likely benign Compiles generated Python source for dynamically created wrapper functions.Reasoning
compile of generated function source in SQLAlchemy's decorator generator (decorator-style wrapper creation with linecache registration) is a known legitimate metaprogramming pattern; the code is internally generated, not attacker-supplied.
-
=likely benign Executes generated wrapper function source in a local namespace.Reasoning
exec of internally generated function source into a local env is the standard decorator-generation mechanism in SQLAlchemy; the code string is built from the function signature of the decorated function, not external input.
-
= =likely benign Dynamically imports a module by path for lazy loading.Reasoning
Lazy module loading by dotted path from a developer-supplied constant is a standard pattern for deferred imports in SQLAlchemy; no obfuscation or remote input involved, though the critical severity overstates it.
-
= # being called from less than 3 (or given) stacklevels, weird,likely benign Walks the call stack to locate a caller frame for warning attribution.Reasoning
sys._getframe with a stacklevel to find the caller for warnings is a standard pattern; the co-occurrence flag with exec in the same file reflects SQLAlchemy's own generated-code helpers, not anti-analysis.
-
= returnlikely benign Executes generated source to construct a helper function.Reasoning
exec of generated source with a copied locals dict to build a set-like function is legitimate code generation in SQLAlchemy's utility module.
-
) and not in : = =likely benign Lazily imports a named module and caches it on the instance.Reasoning
Preloaded-module mechanism imports a module named by a fixed key and caches it in __dict__; this is an intentional lazy import helper, not malicious.
-
= =likely benign Caches a lazily imported module in globals and sys.modules lookup.Reasoning
Writing the imported module into globals() is the documented caching step of the preloaded lazy-import helper; reaching sys.modules by known name is ordinary.
-
= =likely benign Evaluates a string type annotation in the class namespace.Reasoning
eval of string type annotations with class namespace is how Python resolves forward references in typing utilities; standard behavior in SQLAlchemy.
-
=likely benign Evaluates a string type annotation against base globals.Reasoning
Same forward-reference evaluation of annotation strings against module globals; legitimate typing introspection.
-
= returnlikely benign Executes test snippet code in a scratch namespace to extract variables.Reasoning
Test helper executes a test code snippet in an isolated scope to check typing behavior; test-only and not attacker-facing.
-
= =likely benign Executes a repository bootstrap file at conftest import time.Reasoning
Compiles and executes a bootstrap.py file from the repository at import time for pytest plugin setup; this is a known pattern in SQLAlchemy's conftest, and the file is in-repo, but module-scope exec of a sibling file is worth a note since it runs on import.
-
= # noqalikely benign Runs the repository bootstrap code into the conftest namespace.Reasoning
Same bootstrap exec in conftest; the source is the in-repo bootstrap.py, consistent with SQLAlchemy's test setup, so benign unless bootstrap.py itself is tampered with, which this snippet does not show.
-
# test that repr() copies out all argumentslikely benign Evaluates a type repr string in a test asserting repr round-trip.Reasoning
eval of a repr string generated from a type instance in a test verifying repr round-trips; test-only, input is internally produced.
-
= ..likely benign Imports psycopg errors module by version-dependent name in a test.Reasoning
Conditional import of the psycopg errors module based on version in a test; the module name derives from the installed library, standard compatibility shim.
-
= ..likely benign Imports psycopg2 extensions module by name in a test shim.Reasoning
Version-conditional import of psycopg2 extensions in a test compatibility branch; benign.
-
returnlikely benign Test helper that dynamically imports SQLAlchemy dialect submodules by name.Reasoning
Imports each SQLAlchemy dialect module by name from dialects.__all__, a fixed list in the package. This is standard dynamic import for a test harness, with no network, encoding or payload behaviour.
-
):likely benign Test executes generated code that imports and instantiates a SQLAlchemy dialect.Reasoning
Builds a small Python snippet importing an SQLAlchemy dialect and executes it to check that dialect loading works. The name comes from the test's own parameters, so this is ordinary test scaffolding.
-
likely benign Test file that imports pickle and builds comparison expressions with exec over operator strings.
Reasoning
The pickle import is incidental. The exec calls build comparison expressions from a fixed operator string in a test. The multi-stage payload pattern does not fit: there is no decode or fetch step.
-
likely benign exec of a format string built from a test-parameter comparison operator.
Reasoning
exec runs a format string whose only variable is an operator from the test's parameter list. It is a test that checks operator overloading on proxies, with no external input.
-
likely benign exec of a format string built from a test-parameter comparison operator.
Reasoning
Same pattern as the preceding finding: exec of a string built from a fixed comparison operator in a unit test.
-
return ,likely benign Test helper that execs generated class source to construct a mapped class.Reasoning
Compiles and runs generated class source into a provided globals dict, then reads back the class. This is a common technique for testing ORM class-construction behaviour, and the code is test-authored.
-
likely benign Performance script that optionally shells out to the runsnake profiler viewer on a file.
Reasoning
The shell call is gated on a runsnake flag and runs a profiling viewer on a local filename. It is an unquoted shell interpolation, a minor injection risk in a dev script, but not malicious or obfuscated.
-
= =likely benign Test execs generated lambda source to exercise SQL lambda statement behaviour.Reasoning
Executes generated lambda source into a dict to test SQL lambda statement caching. The code is authored inside the test, so this is a legitimate testing technique.
-
# the repr round tripslikely benign Test evals a ForeignKey repr to verify the repr round-trips.Reasoning
eval of repr(fk) checks that a ForeignKey repr round-trips. The eval target is the object's own repr in a test, with no external input and no decoder step.
-
# the repr round tripslikely benign eval of a ForeignKey repr to verify round-trip behaviour in a test.Reasoning
Same eval(repr(fk)) round-trip check as the preceding finding, a standard repr test.
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.
&&