T08 · Insecure Dependencies
- Location
scripts/render_mkdocs.py:68- Finding
Runtime Installation and Execution of Unverified Third-Party Dependencies
- Content
View full analysis
None: py = venv_python(venv_path) cmd = [ str(py), "-m", "pip", "install", "--index-url", PIP_INDEX_URL, "--trusted-host", PIP_TRUSTED_HOST, "--disable-pip-version-check", "--no-cache-dir", *REQUIREMENTS, ] print("[render_mkdocs] Installing dependencies (Aliyun mirror):") for req in REQUIREMENTS: print(f" - {req}") try: subprocess.run(cmd, check=True) except subprocess.CalledProcessError as exc: fail( f"pip install failed (exit={exc.returncode}). " f"Command: {' '.join(cmd)}", code=3, ) ``` ```javascript const NPM_REGISTRY = "https://registry.npmmirror.com"; const DEPENDENCIES = { "vitepress": "^1.5.0", "vitepress-plugin-mermaid": "^2.0.17", "mermaid": "^11.4.1", "vue": "^3.5.13", }; ``` ```javascript function npmInstall(workDir, cleanNode) { const nodeModules = join(workDir, "node_modules"); if (existsSync(nodeModules)) { if (cleanNode) { info(`Removing existing node_modules at ${nodeModules}`); rmSync(nodeModules, { recursive: true, force: true }); } else { info(`Reusing existing node_modules at ${nodeModules}`); return; } } const args = [ "install", "--registry", NPM_REGISTRY, "--no-audit", "--no-fund", "--loglevel", "error", ]; info(`Running: npm ${args.join(" ")} (cwd=${ ...[truncated 2922 chars]- Remediation
View remediation
