T08 · Insecure Dependencies
Warning
- Location
- scripts/ocal_bootstrap.py:15
- Finding
- Automatic Installation of Unpinned Python Dependencies<![CDATA[ ## Vulnerability Details **File Location**: `scripts/ocal_bootstrap.py:15-15, 41-49` **Vulnerability Type**: Uncontrolled third-party dependency installation **Risk Level**: Medium ### Vulnerable Code ```python # Dependency list: requests (Graph calls) / msal (authentication renewal) / tzdata (Windows timezone data) REQUIRED = ("requests", "msal", "tzdata") def ensure_deps(): """Check dependencies and automatically install missing packages.""" missing = _missing() if not missing: return pkgs = " ".join(missing) print(t("deps_missing", pkgs=pkgs), file=sys.stderr) print(t("deps_installing"), file=sys.stderr) try: proc = subprocess.run( [sys.executable, "-m", "pip", "install", "--disable-pip-version-check", *missing], capture_output=True, text=True, timeout=300, ) ``` ### Technical Analysis Calendar and authentication commands automatically invoke pip when `requests`, `msal`, or `tzdata` is absent. Although the package names are fixed and the subprocess does not use a shell, package versions and integrity hashes are not pinned. Consequently, the effective code installed and executed can change after the Skill has been reviewed. Installation also depends on the active interpreter's pip configuration, including configured package indexes, mirrors, proxy settings, and trusted hosts. A compromised upstream release, package index, mirror, or local pip configuration could supply malicious package content. Python package installation may execute build-system code and installs importable modules that subsequently run in the Agent process. ### Attack Path 1. An attacker compromises a configured package source, mirror, upstream package release, or local pip configuration. 2. At least one required dependency is absent from the runtime environment. 3. A user or Agent invokes a login or calendar command. 4. `ensure_deps()` automatically runs `python -m pip install` without explicit ...[truncated 795 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace unconstrained package names with a reviewed lock file containing exact versions. 2. Require cryptographic hashes by installing with `--require-hashes`. 3. Use a requirements file similar to: ```text requests==<reviewed-version> --hash=sha256:<reviewed-hash> msal==<reviewed-version> --hash=sha256:<reviewed-hash> tzdata==<reviewed-version> --hash=sha256:<reviewed-hash> ``` 4. Restrict installation to an explicitly configured, trusted HTTPS package index. 5. Avoid automatic installation during normal calendar operations. Detect missing dependencies and present an explicit installation command instead. 6. If automatic installation is retained, require affirmative user approval and display the exact package versions and source before invoking pip. 7. Prefer prebuilt, reviewed environments or signed application distributions so runtime package installation is unnecessary. 8. Run dependency vulnerability and provenance checks as part of release and CI processes. ]]>
