Dangerous chain: exec() wrapping compile
Critical
- Category
- Dangerous Code Execution
- Content
ns["Path"] = Path for block in blocks: try: exec(compile(block, str(src), "exec"), ns) except SyntaxError as exc: offending = "" if exc.lineno and 0 < exc.lineno <= len(block.splitlines()):- Confidence
- 99% confidence
- Finding
- The test extracts Python code blocks from a markdown file and executes them with exec(compile(...)) in-process. If the authoritative markdown source is modified maliciously or compromised in the supply chain, arbitrary Python code runs during testing with the privileges of the test runner, which can read files, spawn processes, and alter the environment.
