T08 · Insecure Dependencies
- Location
scripts/spatiotemporal_fetcher.py:66- Finding
Execution of Mutable External Python Module and Unpinned Dependency Guidance
- Content
View full analysis
Vulnerability Details
File Location:
scripts/spatiotemporal_fetcher.py, lines 66–68 and 116–121
Vulnerability Type: Insecure third-party dependency loading
Risk Level: MediumVulnerable Code
python def __init__(self): try: sys.path.insert(0, '/Users/neocross/.hermes/skills/openclaw-imports/academic-workflow/scripts') from research import search_openalex, search_arxiv self.search_openalex = search_openalex self.search_arxiv = search_arxiv except ImportError as e: print(f"⚠️ academic-workflow unavailable: {e}") self.search_openalex = None self.search_arxiv = Nonepython def __init__(self): try: from duckduckgo_search import DDGS self.DDGS = DDGS except ImportError: print("⚠️ duckduckgo_search is not installed; pip install duckduckgo-search") self.DDGS = NoneTechnical Analysis
The fetcher prepends a hard-coded, user-specific directory outside the audited project to
sys.pathand then importsresearchfrom that location. Python executes module-level code during import. The external file is not pinned to a reviewed version, checked against an integrity hash, or validated as originating from a trusted Skill installation.Consequently, the effective code executed by this Skill is not limited to the reviewed project. Any party or process able to place or modify
research.pyin the referenced directory can cause arbitrary Python code to execute whenAcademicSourceis initialized.The DuckDuckGo fallback message additionally recommends installing an unpinned package. Although the script does not automatically perform the installation, following this instruction resolves the package through the user's configured package index without a version constraint or hash. A compromised package release, unsafe package source, or dependency-confusion condition could there ...[truncated 2504 chars]
- Remediation
View remediation
Remediation Suggestions
-
Remove the hard-coded path modification
- Delete the
sys.path.insertcall. - Do not load executable dependencies from user-specific or mutable directories outside the reviewed package.
- Delete the
-
Use a declared and pinned dependency
- Package the academic-search integration as a normal Python dependency.
- Pin an exact reviewed version in a lock file.
- Verify distribution hashes during installation.
-
Use a trusted cross-Skill interface if direct reuse is required
- Resolve the dependency through the platform's trusted Skill registry rather than an absolute filesystem path.
- Validate the Skill identifier, version, installation root, and integrity metadata before loading it.
- Prefer a constrained subprocess or data-only API over importing another Skill's executable Python module into the current process.
-
Harden Python module resolution
- Avoid prepending writable locations to
sys.path. - Confirm the imported module's resolved path against an allowlisted installation root.
- Reject symbolic links or path traversal that resolve outside that root.
- Record and verify a cryptographic digest of the approved module when reproducible packaging is unavailable.
- Avoid prepending writable locations to
-
Pin the DuckDuckGo package
- Replace the generic installation message with a documented, reviewed version.
- Provide a lock file containing hashes for the package and its transitive dependencies.
- Use a trusted package index explicitly and disable unexpected supplemental indexes where practical.
-
Fail safely
- If dependency origin or integrity cannot be validated, disable the affected source and continue with the remaining research sources.
- Emit a clear security error instead of importing code from an unverified location.
-
