T08 · Insecure Dependencies
- Location
xtrade_futu_skill.py:56- Finding
Automatic Installation of Unpinned Third-Party Dependencies
- Content
View full analysis
Vulnerability Details
File Location:
xtrade_futu_skill.py:56-81,requirements.txt:1-2
Vulnerability Type: Supply-chain exposure through automatic installation of mutable dependency versions
Risk Level: HighVulnerable code (
xtrade_futu_skill.py:56-81):python def ensure_venv(): if os.environ.get("FUTU_SKILL_VENV") == "1": return base_dir = Path(__file__).resolve().parent venv_dir = base_dir / ".venv" python_path = venv_dir / "bin" / "python" pip_path = venv_dir / "bin" / "pip" if sys.platform.startswith("win"): python_path = venv_dir / "Scripts" / "python.exe" pip_path = venv_dir / "Scripts" / "pip.exe" python_cmd = select_python() if python_path.exists(): venv_version = get_python_version(str(python_path)) if not is_compatible_python(venv_version): shutil.rmtree(venv_dir, ignore_errors=True) if not python_path.exists(): subprocess.check_call([python_cmd, "-m", "venv", str(venv_dir)]) if not pip_path.exists(): raise RuntimeError("虚拟环境创建失败") requirements = base_dir / "requirements.txt" subprocess.check_call([str(pip_path), "install", "-r", str(requirements)]) env = os.environ.copy() env["FUTU_SKILL_VENV"] = "1" subprocess.check_call([str(python_path), str(Path(__file__).resolve()), *sys.argv[1:]], env=env) sys.exit(0)Mutable dependency declarations (
requirements.txt:1-2):text futu-api>=1.0.0 akshare>=1.18.0Technical Analysis
The Skill automatically invokes
pip installwhenever it starts outside the managed virtual environment. Both dependencies use lower-bound constraints rather than exact, reviewed versions. No lockfile, package hashes, or trusted-index enforcement is present.Consequently, the effective code executed by the Skill can change without any modification to the audited repository. A new ...[truncated 1709 chars]
- Remediation
View remediation
Remediation Suggestions
- Pin every direct and transitive dependency to an exact, reviewed version.
- Generate a reproducible lockfile containing cryptographic hashes for all supported platforms.
- Install with hash verification, such as
pip install --require-hashes -r requirements.lock. - Configure an explicitly trusted package index instead of silently accepting the user's ambient pip index configuration.
- Do not run dependency installation on every invocation. Separate installation from normal Skill execution and require explicit user approval before downloading packages.
- Record and verify the expected dependency manifest before launching the installed interpreter.
- Add automated dependency vulnerability scanning and controlled update review to the release process.
- Execute the Skill under a minimally privileged account with a restricted environment so a dependency compromise cannot access unrelated secrets.
