T08 · Insecure Dependencies
- Location
scripts/world_cup_calendar.py:118- Finding
Unpinned Global Installation of a Third-Party CLI Package
- Content
View full analysis
Vulnerability Details
File Location:
scripts/world_cup_calendar.py:17, 118-130
Vulnerability Type: Unpinned executable dependency installed globally
Risk Level: MediumVulnerable Code
python LARK_CLI_PACKAGE = "@larksuite/cli"python def install_lark_cli() -> None: if not shutil.which("npm"): print("没有找到 npm,暂时不能自动安装 lark-cli。") print("请先安装 Node.js LTS:https://nodejs.org/") return print(f"开始安装飞书 CLI:npm install -g {LARK_CLI_PACKAGE}") completed = subprocess.run(["npm", "install", "-g", LARK_CLI_PACKAGE], text=True) if completed.returncode != 0: print("安装失败。可以手动执行:") print(f"npm install -g {LARK_CLI_PACKAGE}") raise SystemExit(completed.returncode) print("飞书 CLI 安装完成。")The same unpinned installation is recommended in
README.md:39-49andSKILL.md:32-36, 105-109.Technical Analysis
The
doctor --install-clioperation installs@larksuite/cliwithout specifying an exact version or verifying package integrity. npm therefore resolves whichever package version is currently selected by the registry and may run its lifecycle scripts with the privileges of the user executing the Skill.This makes the effective installed code mutable after the Skill has been audited. Although there is no evidence that the referenced package is currently malicious, compromise of the package, its maintainer account, the registry resolution path, or a future release could introduce arbitrary code without any change to this repository. The use of a global installation also expands the effect beyond this project and may replace an existing system-wide
lark-cliexecutable.Attack Path
- An attacker compromises the npm package, a maintainer account, or the package distribution process.
- A malicious release becomes the version resolved for
@larksuite/cli. - The user runs:
bash python3 scripts/w
...[truncated 983 chars]
- Remediation
View remediation
Remediation Suggestions
- Pin the dependency to an exact, reviewed version:
python LARK_CLI_PACKAGE = "@larksuite/cli@X.Y.Z" - Verify the expected npm registry and package integrity before installation. Record and validate the package tarball integrity hash.
- Prefer a project-local or isolated installation rather than
npm install -g, so the dependency cannot replace system-wide tooling. - Separate environment diagnosis from dependency installation. Require an explicit confirmation that states the package version, source, destination, and security implications.
- Consider removing automatic installation entirely and provide version-pinned manual installation instructions.
- Document a reviewed version allowlist and reject versions outside it.
- Where operationally feasible, disable npm lifecycle scripts during installation and verify that the package functions without them:
bash npm install --ignore-scripts --save-exact @larksuite/cli@X.Y.Z - Re-audit and update the pinned dependency deliberately rather than resolving new releases automatically.
- Pin the dependency to an exact, reviewed version:
