T08 · Insecure Dependencies
- Location
SKILL.md:402- Finding
Automatic Runtime Installation of an Unpinned Dependency
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 402–419
Vulnerability Type: Supply-chain exposure through automatic dependency installation
Risk Level: MediumComplete Code Snippet:
python def next_runs(expression: str, count: int = 5, after: Optional[datetime] = None) -> list[datetime]: """ Calculate the next N run times for a cron expression. Uses croniter if available, otherwise falls back to manual calculation. """ after = after or datetime.now(tz=timezone.utc) try: from croniter import croniter cron = croniter(expression, after) return [cron.get_next(datetime) for _ in range(count)] except ImportError: pass # Fallback: install croniter import subprocess subprocess.run(['pip', 'install', 'croniter', '-q'], check=True) from croniter import croniter cron = croniter(expression, after) return [cron.get_next(datetime) for _ in range(count)]Technical Analysis
When
croniteris unavailable, the function automatically invokespip install croniterat runtime. The dependency is not pinned to a reviewed version, no package hash is verified, and installation is not isolated or subject to explicit user approval.Package resolution depends on the environment's active pip configuration and package indexes. Therefore, a compromised package release, package repository, mirror, DNS/network path, or pip configuration could supply malicious installation content. Python package installation may execute build-system or setup code, resulting in code execution during installation.
This behavior also conflicts with the Skill's claim of “Zero external API — pure local parsing,” because it can initiate network access and alter the Python environment. It exceeds the minimum privileges needed to explain cron expressions: next-run calculation should use a predeclared dependency or fail safely rather th ...[truncated 1377 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the runtime
subprocess.run(['pip', 'install', ...])operation. - Declare
croniteras an explicit project dependency and pin it to a reviewed version. - Use lock files or hash-verified dependency installation, such as pip's
--require-hashes, to ensure package integrity. - Install dependencies only during an explicit setup phase in an isolated virtual environment or container.
- If
croniteris unavailable, return a clear dependency error instead of modifying the environment. - If zero-dependency operation is required, implement and test a genuinely local next-run calculator rather than downloading code.
- Document any required network access and obtain explicit user approval before dependency installation.
- Run the Skill with least privilege and restrict filesystem, credential, and network access to reduce supply-chain compromise impact.
- Remove the runtime
