Dangerous chain: exec() wrapping compile
Critical
- Category
- Dangerous Code Execution
- Content
mod = types.ModuleType('v21_patched') mod.__file__ = '<patched>' exec(compile(source, '<patched>', 'exec'), mod.__dict__) split_fn = mod.split_sql_file # CLI- Confidence
- 98% confidence
- Finding
- The script reads Python source from disk, rewrites it as text, then executes it with exec(compile(...)). This creates a code-injection and trust-boundary violation: any tampering with split_sql_v21.py or the expected scripts directory results in arbitrary code execution when this utility runs. In the context of a SQL splitter, dynamically executing patched source is unnecessary and substantially more dangerous than ordinary importing.
