T08 · Insecure Dependencies
- Location
scripts/invoice.py:54- Finding
Unpinned Third-Party Dependency Installation Guidance
- Content
View full analysis
Vulnerability Details
File Location:
scripts/invoice.py, lines 54–57 and 238–241
Vulnerability Type:T08: Insecure Dependencies
Risk Level: MediumVulnerable code (lines 54–57):
python try: from fpdf import FPDF except ImportError: print(" ❌ Install fpdf2: pip install fpdf2") sys.exit(1)Repeated vulnerable code (lines 238–241):
python try: from fpdf import FPDF except ImportError: print(" ❌ Install fpdf2: pip install fpdf2") sys.exit(1)Technical Analysis
When the required PDF library is unavailable, both invoice-generation paths instruct the user to run
pip install fpdf2. This installation command does not pin a reviewed package version, validate package hashes, specify a trusted package index, or use a project lockfile.Python package installation may execute package-controlled build or installation logic. Consequently, the effective code installed by the recommended command can change after this Skill has been reviewed. The imported module name,
fpdf, also differs from the distribution name,fpdf2, which can make package provenance less apparent during manual inspection.The Skill does not automatically run the installation command, so exploitation requires the user or an automation layer to follow the displayed instruction.
Attack Path
- A user invokes the
createorremindcommand in an environment where the PDF dependency is absent. - The script displays the recommendation
pip install fpdf2. - The user or surrounding automation executes that unpinned installation command.
- The configured package index supplies the latest matching package release rather than a previously reviewed artifact.
- If the package source, release, index configuration, or dependency chain has been compromised, malicious package-controlled code may execute during installation or when
from fpdf import FPDFis subsequently e ...[truncated 860 chars]
- A user invokes the
- Remediation
View remediation
Remediation Suggestions
- Declare
fpdf2in a project dependency manifest and pin it to a specifically reviewed version. - Maintain a lockfile or hash-pinned requirements file so installations resolve to reproducible artifacts.
- Require package hash validation, such as installation with
pip --require-hashes. - Install dependencies inside an isolated virtual environment under a non-privileged account.
- Explicitly configure and document an approved package index rather than relying on ambient
pipconfiguration. - Review direct and transitive dependency updates before changing pinned versions.
- Replace the generic installation prompt with a command that references the maintained dependency file, for example:
python except ImportError: print("Install the audited dependencies from the project lockfile.") print("Example: python3 -m pip install --require-hashes -r requirements.txt") sys.exit(1)- Apply the same remediation to both affected import blocks to keep the
createandremindcommands consistent.
- Declare
