`--run-selected` 会在本机执行由不受信任 README 自动选出的命令
原文依据:5 处编排器从仓库文档提取并按启发式规则选择命令;启用 `--run-selected` 后,所选字符串被交给持久运行器并最终通过 `subprocess.Popen` 启动。仅仅出现在 README 中不代表该命令已被用户逐项审核。
恶意或被篡改的仓库可把 Python 脚本或其他程序包装成推理、评测或训练示例,从而以当前用户权限读取或修改文件、访问网络、消耗 GPU/CPU,或调用用户账户中的工具。
该风险有源码支持,但只有用户显式传入 `--run-selected` 才会执行。编排器会从 README/链接文档提取候选项,自动按类别和评分选出命令,然后把命令交给运行器;运行器最终在目标仓库目录通过 `subprocess.Popen` 启动。README 属于目标仓库控制的数据,自动选择不等于逐项人工审核。用户可限制为不启用该参数,并要求作者展示最终 argv、来源位置和工作目录后再授权。
for category in ["inference", "evaluation", "training", "other"]: candidates = [item for item in commands if item.get("category") == category] if not candidates: continue runnable = [ item for item in candidates if not item.get("needs_substitution") and command_feasibility(item, repo_path)[0] ] if not runnable: continue best = max(runnable, key=lambda item: command_score(item, produced_out_dirs)) return { "selected_goal": category, "goal_priority": category, "documented_command": best.get("command", ""), "command_source": best.get("source", "readme"),查看另外 4 个位置
) else: run_data = maybe_run_command( repo_path, chosen["documented_command"], args.timeout, args.user_language, args.shell_mode, runtime_root, model_adapter, args.monitor_gpu, ) try: argv = build_command(command, shell_mode) environment = dict(os.environ if child_env is None else child_env) spec["requested_argv"] = list(argv) atomic_write_json(run_dir / "spec.json", spec) if shell_mode == "direct": argv = resolve_direct_argv(argv, repo, environment) spec["argv"] = list(argv) atomic_write_json(run_dir / "spec.json", spec) creationflags = subprocess.CREATE_NEW_PROCESS_GROUP if os.name == "nt" else 0 process = subprocess.Popen( argv, env=environment, cwd=repo, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, encoding="utf-8", errors="replace", bufsize=1, creationflags=creationflags, start_new_session=os.name != "nt", ) except (FileNotFoundError, ShellSyntaxRequired, OSError, ValueError) as exc: parser.add_argument("--user-language", default="en", help="Language tag for human-readable reports.") parser.add_argument("--run-selected", action="store_true", help="Execute the selected documented command.") parser.add_argument("--include-analysis-pass", action="store_true", help="Run analyze-project and record its outputs in the stage ledger.") creationflags = subprocess.CREATE_NEW_PROCESS_GROUP if os.name == "nt" else 0 process = subprocess.Popen( argv, env=environment, cwd=repo, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, encoding="utf-8", errors="replace", bufsize=1, creationflags=creationflags, start_new_session=os.name != "nt", ) except (FileNotFoundError, ShellSyntaxRequired, OSError, ValueError) as exc: