T08 · Insecure Dependencies
- Location
src/run.py:1- Finding
Runtime Dependency Resolution Without Cryptographic Integrity Verification
- Content
View full analysis
Vulnerability Details
File Location:
src/run.py:1-4
Vulnerability Type: Unverified third-party dependency resolution
Risk Level: MediumVulnerable Code
python #!/usr/bin/env python3 # /// script # dependencies = ["defillama-sdk==0.1.4"] # ///The dependency is subsequently imported and trusted by
src/run.py:13-19:python from defillama_sdk import ( ApiError, ApiKeyRequiredError, DefiLlamaError, NotFoundError, RateLimitError, )The imported SDK receives the user's API key through
src/scripts/_shared.py:17-22:python def build_clients(api_key: Optional[str]) -> tuple[DefiLlama, DefiLlama]: client = DefiLlama() if api_key: pro_client = DefiLlama({"api_key": api_key}) else: pro_client = DefiLlama() return client, pro_clientTechnical Analysis
The inline dependency declaration pins
defillama-sdkto version0.1.4, which reduces unintended version drift but does not cryptographically bind execution to a reviewed package artifact. The project contains no lockfile with artifact hashes, vendored dependency, or explicit trusted package-index configuration.The documented invocation pattern uses
uv run, which may resolve and install the declared dependency when a prepared environment is unavailable. Package imports execute Python module initialization code with the same operating-system privileges as the caller. Consequently, a compromised or substituted package artifact could execute before the Skill processes a command.This dependency is security-sensitive because the SDK is given the optional
DEFILLAMA_API_KEYvalue. Malicious initialization or client-construction code could read that credential, access other data available to the process, or perform arbitrary actions permitted to the user.Attack Path
- The user invokes a documented command such as
uv run src/run.py ......[truncated 1633 chars]
- The user invokes a documented command such as
- Remediation
View remediation
Remediation Suggestions
- Create and commit a
uv.lockfile that records the exact dependency artifacts and cryptographic hashes. - Execute dependency installation and Skill commands in locked or frozen mode so resolution fails rather than silently selecting an unreviewed artifact.
- Configure an explicit, trusted Python package index and disable unintended fallback indexes.
- Prefer installing dependencies during a controlled setup phase instead of resolving packages during each command invocation.
- Verify the provenance and published hashes of
defillama-sdk==0.1.4before deployment. - Run the Skill with least privilege and expose only the required environment variable.
- Rotate the DefiLlama API key immediately if dependency compromise is suspected.
- Audit and deliberately update the lockfile whenever the SDK version changes.
- Create and commit a
