T08 · Insecure Dependencies
- Location
requirements.txt:1- Finding
Unpinned Third-Party Dependency Creates a Supply-Chain Risk
- Content
View full analysis
Vulnerability Details
File Location:
requirements.txt:1
Related Location:holiday.py:11-15
Vulnerability Type: T08: Insecure Dependencies
Risk Level: MediumVulnerable Code
requirements.txt:1:text chinese-calendarRelated installation guidance in
holiday.py:11-15:python try: import chinese_calendar except ImportError: print("Please install chinese-calendar: pip install chinese-calendar") sys.exit(1)The quoted English message is a translation of the original installation prompt; its command is unchanged.
Technical Analysis
The project declares
chinese-calendarwithout an exact version or integrity hash. The fallback message also recommends an unconstrainedpip install chinese-calendarcommand.Consequently, installations are not reproducible and may retrieve any release selected by the configured package index. This does not demonstrate that the current upstream package is malicious. However, it creates a supply-chain exposure if a future release is compromised, the package owner or distribution account is compromised, or the installer is configured to use an untrusted package index.
Python packages may execute code during installation, and imported modules execute top-level code at runtime. The application imports this dependency whenever
holiday.pyis loaded, so a malicious resolved package could execute before the calendar functionality is used.Attack Path
- An attacker compromises the package's distribution channel or causes the victim's package installer to resolve the dependency through an attacker-controlled or untrusted index.
- The attacker publishes a malicious release under the dependency name.
- A user runs
pip install -r requirements.txtor follows the installation command printed byholiday.py. - Because no version or hash is enforced, the installer accepts the attacker-controlled distribution.
- Malicious code executes during installation or when `hol ...[truncated 664 chars]
- Remediation
View remediation
Remediation Suggestions
-
Pin the dependency to an exact, reviewed release:
text chinese-calendar==<reviewed-version> -
Generate and commit cryptographic hashes for all resolved distributions, then install with hash verification:
bash python -m pip install --require-hashes -r requirements.txt -
Use a lock-generation workflow such as
pip-toolsso direct and transitive dependencies are fixed and reviewed. -
Install only from an explicitly approved HTTPS package index; disable unintended supplemental indexes where practical.
-
Add automated dependency vulnerability and provenance checks to CI.
-
Test dependency updates in an isolated environment before changing the reviewed pin and hashes.
-
Run installation and the Skill under a least-privileged account or isolated environment to reduce the impact of a compromised dependency.
-
