T08 · Insecure Dependencies
- Location
scripts/main.py:12- Finding
Automatic Installation of an Unpinned Tencent Cloud SDK in the Main Workflow
- Content
View full analysis
Vulnerability Details
File Location:
scripts/main.py, lines 12-23
Vulnerability Type: Unpinned runtime dependency installation
Risk Level: Mediumpython def ensure_dependencies(): try: import tencentcloud # noqa: F401 except ImportError: print("[INFO] tencentcloud-sdk-python not found. Installing...", file=sys.stderr) subprocess.check_call( [sys.executable, "-m", "pip", "install", "tencentcloud-sdk-python", "-q"], stdout=sys.stderr, stderr=sys.stderr, ) print("[INFO] tencentcloud-sdk-python installed successfully.", file=sys.stderr) ensure_dependencies()Technical Analysis
The main execution path automatically downloads and installs
tencentcloud-sdk-pythonfrom the package index when thetencentcloudmodule is unavailable. The dependency has no exact version constraint or integrity hash. Consequently, the code executed by the Skill depends on mutable external package-registry content that may change after the Skill has been reviewed.Although the command uses an argument list rather than a shell and is therefore not directly vulnerable to command injection, it creates a supply-chain risk. A compromised upstream release, publisher account, package registry, or transitive dependency could introduce malicious code. The installed SDK is imported immediately afterward, causing malicious module-level code to run in the same process context as the Skill.
Installation also modifies the active Python environment automatically and without a separate controlled setup or approval phase.
Attack Path
- The Skill runs in an environment where the
tencentcloudmodule is not installed. - An attacker compromises the relevant package release, publisher account, registry distribution channel, or one of its unpinned transitive dependencies.
ensure_dependencies()invokes pip and installs the current ...[truncated 1010 chars]
- The Skill runs in an environment where the
- Remediation
View remediation
Remediation Suggestions
- Remove runtime package installation from the executable workflow.
- Declare an exact, reviewed SDK version in a dependency manifest or lock file, for example:
text tencentcloud-sdk-python==<reviewed-version> - Generate and verify cryptographic hashes for the package and all transitive dependencies. Install with pip's
--require-hashesoption. - Install dependencies during a controlled build or deployment stage rather than while processing a user request.
- Use an isolated virtual environment or immutable container image.
- If the dependency is missing at runtime, terminate with clear setup instructions instead of automatically modifying the environment.
- Regularly scan and update the pinned dependency through a reviewed change-management process.
- Run the Skill with least-privilege credentials and prefer temporary Tencent Cloud tokens with narrowly scoped permissions.
