T08 · Insecure Dependencies
- Location
scripts/calculate_bazi.py:1- Finding
Unpinned Third-Party Dependency Allows Supply-Chain Code Execution
- Content
View full analysis
Vulnerability Details
File Location:
scripts/calculate_bazi.py:1-10
Vulnerability Type: Unpinned executable third-party dependency
Risk Level: MediumVulnerable Code
python #!/usr/bin/env -S uv run # /// script # dependencies = ["lunar-python>=1.4.8,<2"] # /// import argparse import json import re import sys from dataclasses import asdict, dataclass from lunar_python import Lunar, SolarTechnical Analysis
The script uses
uv runwith inline dependency metadata that permits anylunar-pythonrelease from version 1.4.8 up to, but not including, version 2. No project lockfile, exact version constraint, integrity hash, or vendored audited package is present.When the script runs in an environment where the dependency is not already securely locked and cached,
uvmay resolve and download a later package release satisfying this range. The subsequent import oflunar_pythonexecutes the package's module initialization code in the local Python process.This is a supply-chain weakness rather than evidence that the currently published dependency is malicious. Exploitation requires compromise of the package, its publisher account, the package registry, or another relevant dependency-resolution channel.
Attack Path
- An attacker compromises the
lunar-pythonpublishing account or otherwise gains the ability to publish a malicious release under that package name. - The attacker publishes a version satisfying
>=1.4.8,<2. - A user or Agent invokes
scripts/calculate_bazi.pythroughuv run. - In the absence of an exact lock and integrity verification,
uvresolves and installs the attacker-controlled compatible release. - The statement
from lunar_python import Lunar, Solarimports that release. - Malicious package initialization code executes with the privileges and environment access of the process running the Skill.
Impact Assessment
Su ...[truncated 572 chars]
- An attacker compromises the
- Remediation
View remediation
Remediation Suggestions
- Pin
lunar-pythonto a specific version that has been reviewed and tested, rather than accepting a broad compatible range. - Generate and commit a dependency lockfile so all executions resolve the same dependency graph.
- Require cryptographic integrity verification, such as package hashes, where supported by the deployment workflow.
- Configure dependency resolution to use an explicitly trusted package index and prevent fallback to untrusted or unintended indexes.
- Review dependency updates before changing the pinned version, including package ownership, release history, source changes, and transitive dependencies.
- Run the script with least privilege in a restricted environment that has no unnecessary credentials, filesystem permissions, or outbound network access.
- In higher-assurance deployments, build from an internally mirrored or vendored, audited copy of the dependency and prohibit runtime package downloads.
- Pin
