T08 · Insecure Dependencies
Warning
- Location
- references/example-weather-api.md:59
- Finding
- Unpinned and Unverifiable npm Dependency Installation## Vulnerability Details **File Location**: `references/example-weather-api.md`, lines 59–61 **Vulnerability Type**: Supply-chain exposure through an unpinned third-party dependency **Risk Level**: Medium ### Vulnerable Code ```bash npm install @example/weather-sdk ``` ### Technical Analysis The tutorial directs users to install `@example/weather-sdk` without specifying an exact version, lockfile integrity value, verified registry, or package provenance. The package and associated service identities are placeholders, so the project provides no basis for confirming that the installed package is authentic or controlled by a trusted publisher. npm installation can execute package lifecycle scripts such as `preinstall`, `install`, and `postinstall`. Consequently, a malicious, compromised, or dependency-confusion package could execute code during installation with the permissions of the user running npm. This executable dependency is not necessary to demonstrate the Skill's documentation-writing patterns; pseudocode or an explicitly non-operational example would satisfy the declared purpose with less risk. ### Attack Path 1. An attacker registers or compromises the package named `@example/weather-sdk`, or compromises one of its transitive dependencies. 2. A user follows the bundled tutorial and runs `npm install @example/weather-sdk`. 3. npm resolves an attacker-controlled package version because the tutorial does not pin or authenticate the expected artifact. 4. Malicious package code runs during installation or when the tutorial imports the SDK. 5. The code accesses data and resources available to the current OS user, potentially including project files, environment variables, developer credentials, and network access. ### Impact Assessment Successful exploitation could provide arbitrary code execution with the privileges of the user running npm. The affected scope may include the tutorial project, files readable or writ ...[truncated 328 chars]
- Remediation
- ## Remediation Suggestions - Replace the placeholder dependency with an explicitly identified, official package from a documented registry. - Pin an audited exact version rather than allowing npm to select the current version. - Commit and verify a lockfile containing package integrity metadata. - Document how users can verify the package publisher, registry, and provenance. - Use `npm install --ignore-scripts` when package lifecycle scripts are not required. - Audit direct and transitive dependencies before publishing the tutorial. - Prefer non-executable pseudocode for a generic documentation-pattern example, since executing a third-party package is not required to teach tutorial structure.
