T08 · Insecure Dependencies
- Location
- SKILL.md:7
- Finding
- Unpinned Third-Party Repository and Unsafe Dependency Installation## Vulnerability Details **File Location**: `SKILL.md`, lines 7–12 **Vulnerability Type**: Supply-chain risk caused by installing and executing unpinned third-party code **Risk Level**: High **Complete Code Snippet**: ```sh Install Clone and install the CLI: ``` ```sh git clone https://github.com/FroeMic/notion-cli cd notion-cli npm install npm run build npm link ``` ### Technical Analysis The installation instructions clone the mutable default branch of an external GitHub repository without pinning a reviewed commit or release tag and without verifying its integrity. The project under audit contains no vendored source or lockfile through which the fetched implementation and its dependency graph can be independently reviewed. Running `npm install` can execute dependency lifecycle scripts. The subsequent `npm run build` explicitly executes repository-controlled build logic, and `npm link` exposes the resulting command through the user's global npm environment. Consequently, the code ultimately executed can differ from the code that existed when this Skill was audited. This is a supply-chain weakness rather than evidence that the named repository is currently malicious. Exploitation requires compromise or malicious modification of the upstream repository, its npm dependencies, or the resolved dependency graph. ### Attack Path 1. An attacker compromises the referenced repository, a maintainer account, or a dependency resolved by `npm install`. 2. The attacker adds a malicious lifecycle script, build script, dependency, or CLI implementation to the mutable upstream source. 3. A user follows the Skill instructions and clones the current default branch. 4. `npm install` or `npm run build` executes the attacker-controlled code with the user's local privileges. 5. `npm link` may make the compromised CLI globally available to that user, allowing later invocations of the apparently legitimate `notion` command to ex ...[truncated 977 chars]
- Remediation
- ## Remediation Suggestions 1. Pin the repository to a specific reviewed commit hash rather than cloning and building the mutable default branch: ```sh git clone https://github.com/FroeMic/notion-cli cd notion-cli git checkout --detach <reviewed-commit-sha> ``` 2. Publish and verify signed release tags or release artifacts. Document the expected commit identifier and cryptographic checksum in the Skill. 3. Require a committed npm lockfile and use `npm ci` instead of `npm install` so dependency resolution is reproducible. 4. Audit package lifecycle and build scripts before execution. Where compatible with the package, initially install with scripts disabled: ```sh npm ci --ignore-scripts ``` Run only explicitly reviewed scripts afterward. 5. Avoid `npm link` unless global command exposure is necessary. Prefer a project-local installation or an isolated execution environment with minimal filesystem and network access. 6. Execute installation and the CLI as an unprivileged user. Do not use `sudo` or an administrator shell. 7. Grant the Notion integration access only to the minimum required pages and databases and only the required read/write capabilities. 8. Store `NOTION_API_KEY` in a protected secret store where possible. If a local environment file is used, restrict it to the owning user, exclude it from version control, and avoid passing the token through command-line arguments that may be exposed in process listings or shell history.
