T08 · Insecure Dependencies
Warning
- Location
- scripts/extract_pdf.py:84
- Finding
- Unpinned Third-Party Package Is Resolved and Executed at Runtime## Vulnerability Details **File Location**: `scripts/extract_pdf.py:84-85` **Vulnerability Type**: Runtime dependency resolution and supply-chain exposure **Risk Level**: Medium ### Technical Analysis The extractor invokes `uvx` with the unpinned package specification `markitdown[pdf]`: ```python def extract_with_markitdown(pdf_path: Path, output_path: Path, timeout: int) -> dict: uvx = detect_uvx() if not uvx: return { 'ok': False, 'method': 'markitdown', 'error': 'uvx not found', 'install_hint': "python3 -m pip install --user --break-system-packages uv", } ensure_parent(output_path) cmd = [uvx, '--from', 'markitdown[pdf]', 'markitdown', str(pdf_path), '-o', str(output_path)] try: proc = run(cmd, timeout=timeout) ``` Because no exact version, lock file, package hash, or controlled package index is specified, each invocation may resolve a different release and set of transitive dependencies. This makes the effective executable code mutable after the Skill has been reviewed. The dependency is executed with the same operating-system identity and permissions as the Skill. Although using `uvx` is necessary to support the declared extraction workflow, dynamically resolving an unconstrained package exceeds the minimum supply-chain trust required for that functionality. ### Attack Path 1. An attacker compromises a future release of `markitdown`, one of its PDF extras, or a transitive dependency available through the configured package index. 2. An operator invokes the PDF extraction workflow. 3. `uvx --from 'markitdown[pdf]'` resolves the affected package version. 4. Package installation or execution runs attacker-controlled code under the invoking user's account. 5. The malicious dependency can access files and resources available to that account, including the PDF being processed and workspace data. ### Impact ...[truncated 446 chars]
- Remediation
- ## Remediation Suggestions - Pin `markitdown` and all relevant transitive dependencies to audited versions. - Use a lock file with cryptographic hashes and enforce hash verification during installation. - Resolve packages from a controlled, trusted index rather than implicitly trusting the runtime environment's configured indexes. - Prefer a prebuilt, reviewed virtual environment or container instead of resolving dependencies during every extraction. - Establish an explicit dependency-update process that includes security review and testing. - Run PDF conversion in a sandbox with restricted filesystem access, network access, process creation, and resource limits.
