T08 · Insecure Dependencies
- Location
install.sh:8- Finding
Mutable Remote Sources and Unpinned Third-Party Dependencies
- Content
View full analysis
/dev/null || true fi echo "✅ 更新完成!版本:$(git describe --tags --always 2>/dev/null || echo 'latest')" exit 0 fi ``` `install.sh:33-43`: ```bash git clone "$REPO_URL" "$TARGET_DIR" cd "$TARGET_DIR" # 创建 Python 虚拟环境 echo "🐍 创建 Python 虚拟环境..." python3 -m venv .venv .venv/bin/pip install --upgrade pip .venv/bin/pip install python-docx matplotlib pillow ``` `requirements.txt:1-3`: ```text python-docx>=1.1.0 matplotlib>=3.7.0 pillow>=10.0.0 ``` `SKILL.md:161-165` also instructs users to install unpinned Python and npm dependencies: ```bash .venv/bin/pip install python-docx matplotlib pillow cd ~/.workbuddy/binaries/node/workspace 2>/dev/null || mkdir -p ~/.workbuddy/binaries/node/workspace cd ~/.workbuddy/binaries/node/workspace && npm install @mermaid-js/mermaid-cli ``` ### Technical Analysis The installation and update process trusts mutable upstream state: 1. `git clone` retrieves the current state of a remote repository without pinning or verifying a reviewed tag, commit hash, checksum, or signature. 2. `git pull` automatically incorporates future upstream changes into an installed Skill. 3. Python dependencies use lower-bound constraints rather than exact versions. Any future version satisfying the constraint can be installed. 4. The installer separately installs package names without version constrai ...[truncated 2403 chars]- Remediation
View remediation
matplotlib== pillow== ``` 3. **Use hash-locked dependencies** - Generate a lock file containing hashes for every direct and transitive dependency. - Install with hash verification, for example: ```bash python -m pip install --require-hashes -r requirements.lock ``` 4. **Pin the npm dependency** - Specify an exact reviewed version of `@mermaid-js/mermaid-cli`. - Commit and enforce a lockfile. - Use `npm ci` rather than an unrestricted `npm install` in reproducible environments. 5. **Restrict package sources** - Explicitly configure trusted Python and npm registries. - Avoid unexpected fallback indexes. - Consider using an internally mirrored and reviewed package repository. 6. **Verify release integrity** - Publish checksums or signatures for Skill releases. - Validate downloaded artifacts before installation. - Record the installed Skill revision and dependency versions for auditability. 7. **Fail closed during updates** - Remove `2>/dev/null || true`. - Surface dependency installation failures and abort the update if environment synchronization fails. - Perform updates in a staging directory and replace the active installation only after all verification and installation steps succeed. 8. **Add automated supply-chain checks** - Scan locked dependencies for known vulnerabilities. - Review dependency changes before release. - Generate a software bill of materials for each published version. ]]>
