T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:30
- Finding
- Unpinned npx Commands May Download and Execute Unreviewed Packages<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 30-56 **Vulnerability Type**: Unsafe dependency retrieval and execution **Risk Level**: Medium ### Vulnerable Code ```bash cd <project> && npx tsc --noEmit 2>&1 ``` ```bash cd <project> && npx type-coverage 2>&1 || echo "type-coverage not installed — skip" ``` ### Technical Analysis The validation instructions invoke `tsc` and `type-coverage` through `npx` without requiring an existing local installation, disabling automatic installation, or pinning the executable to a reviewed package version. Depending on the npm and `npx` version and configuration, `npx` may retrieve a package from the configured npm registry when the requested executable is unavailable locally. The downloaded package can execute installation lifecycle scripts or provide the command that is subsequently run. This means the effective code being executed may not have been present during the skill audit. The `npx tsc` command is also ambiguous because it requests an executable name rather than explicitly verifying that the executable belongs to a lockfile-pinned installation of the official `typescript` package. ### Attack Path 1. An attacker causes the validator to operate on a project that does not contain the expected local `tsc` or `type-coverage` executable. 2. The validator follows the documented command and invokes `npx`. 3. `npx` resolves the missing executable through the configured npm registry. 4. A malicious, compromised, confused, or otherwise unreviewed package is downloaded. 5. Package lifecycle scripts or the resolved executable run under the validator process's user account. 6. The downloaded code can access resources available to that account, including project files and locally exposed credentials. ### Impact Assessment Successful exploitation provides code execution with the operating-system privileges of the user or agent running the validator. The affected scope may include: - Reading, modif ...[truncated 509 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require the relevant tools to be declared as lockfile-pinned development dependencies. 2. Disable implicit package installation: ```bash cd -- "$project" && npx --no-install tsc --noEmit cd -- "$project" && npx --no-install type-coverage ``` 3. Prefer invoking verified local executables directly: ```bash cd -- "$project" && ./node_modules/.bin/tsc --noEmit ``` 4. Before execution, verify that `typescript` and `type-coverage` are present in the project lockfile and installed from an approved registry. 5. Use reproducible installation controls such as `npm ci`, a committed lockfile, registry allowlisting, and integrity verification. 6. Fail safely when a required executable is absent rather than automatically retrieving it. 7. Run validation in a restricted container or sandbox without production credentials and with only necessary filesystem and network access. ]]>
