Dynamic import via __import__()
Medium
- Category
- Dangerous Code Execution
- Content
def try_import(*packages): for pkg in packages: try: __import__(pkg) except ImportError: os.system(f'pip install {pkg} -q')- Confidence
- 88% confidence
- Finding
- The code performs dynamic imports over a runtime-supplied package list and couples that behavior to automatic installation when imports fail. While the current list is hardcoded, this pattern weakens supply-chain safety and makes execution behavior depend on host state, which is risky for a document-comparison skill that should not modify its environment.
