T03 · Remote Payload Retrieval and Execution
- Location
scripts/setup.py:67- Finding
Mutable Third-Party Source and Packages Are Downloaded and Executed Automatically
- Content
View full analysis
str | None: if NODE_MODULES.is_dir(): return None r = subprocess.run( ["npm", "install", "--omit=dev", "--no-audit", "--no-fund"], cwd=str(WEMD_DIR), capture_output=True, text=True, timeout=120, ) if r.returncode != 0: return f"npm install failed: {r.stderr.strip()[:300]}" _patch_markdown_it() return None def _build_core() -> str | None: if CORE_DIST.is_dir() and any(CORE_DIST.iterdir()): return None with tempfile.TemporaryDirectory() as tmpdir: tmp = Path(tmpdir) r = subprocess.run( ["git", "clone", "--depth", "1", WEMD_REPO, str(tmp / "WeMD")], capture_output=True, text=True, timeout=60, ) if r.returncode != 0: return f"git clone failed: {r.stderr.strip()[:300]}" core_dir = tmp / "WeMD" / "packages" / "core" r = subprocess.run( ["npm", "install", "--no-audit", "--no-fund"], cwd=str(core_dir), capture_output=True, text=True, timeout=120, ) if r.returncode != 0: return f"core npm install failed: {r.stderr.strip()[:300]}" r = subprocess.run( ["npx", "--yes", "typescript", "--build"], cwd=str(core_dir), capture_output=True, text=True, timeout=60, ) if r.returncode != 0: tsc_bin = core_dir / "node_modules" / ".bin" / "tsc" r = subprocess.run( [str(tsc_bin)] if tsc_bin.is_file() else ["npx", "tsc"], cwd=str(core_dir), capture_output=True, text=True, timeout=60, ) ``` The bundled package manifest also uses ...[truncated 3012 chars]- Remediation
View remediation
