From 43596f2390789241d27bfb5526e863f22e3a8f6d Mon Sep 17 00:00:00 2001 From: orbisai0security Date: Mon, 20 Jul 2026 20:07:28 +0000 Subject: [PATCH] fix: V-001 security vulnerability Automated security fix generated by OrbisAI Security --- diagrams/cli.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/diagrams/cli.py b/diagrams/cli.py index c75eb3d9..81731b84 100644 --- a/diagrams/cli.py +++ b/diagrams/cli.py @@ -1,4 +1,5 @@ import argparse +import runpy import sys @@ -24,8 +25,10 @@ def run() -> int: args = parser.parse_args() for path in args.paths: - with open(path, encoding='utf-8') as f: - exec(f.read()) + if not path.endswith(".py"): + print(f"Error: {path} is not a Python file", file=sys.stderr) + return 1 + runpy.run_path(path, run_name="__main__") return 0