T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:129
- Finding
- Unpinned Third-Party Package Execution Through npx<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:129`; also present in `README.md:35` and `template/generate-doc-index.ts:1,10-12` **Vulnerability Type**: Unpinned third-party dependency execution **Risk Level**: Medium ### Vulnerable Code ```bash npx tsx scripts/generate-doc-index.ts all ``` The template also uses `npx tsx` as its interpreter: ```typescript #!/usr/bin/env npx tsx /** * Usage: * npx tsx scripts/generate-doc-index.ts adr * npx tsx scripts/generate-doc-index.ts pitfall * npx tsx scripts/generate-doc-index.ts all */ ``` ### Technical Analysis The documented command invokes `tsx` through `npx` without specifying an exact version. The project does not include a package manifest, lockfile, or integrity information that would constrain which `tsx` package release is executed. If `tsx` is not already available locally, `npx` can retrieve it from the configured package registry and immediately execute its package code. This creates a supply-chain trust boundary that is not disclosed or controlled by the otherwise stated “zero external dependencies” design. The effective executable can change after the Skill has been reviewed. This is an insecure dependency-execution pattern rather than evidence that the current `tsx` package is malicious. ### Attack Path 1. A user copies the template into a repository and follows the documented `npx tsx` command. 2. No audited local version of `tsx` is installed. 3. `npx` resolves the package through the user's configured registry. 4. An attacker has compromised a resolved package release, the registry account, or the user's registry configuration. 5. `npx` downloads and executes the compromised package before or while running the generator. 6. The malicious package executes with the same operating-system permissions, environment variables, and repository access as the invoking user or CI worker. ### Impact Assessment A compromised dependency could execute arbitrary code with the in ...[truncated 465 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Add `tsx` as an exact-version development dependency, for example: ```json { "devDependencies": { "tsx": "4.20.5" }, "scripts": { "generate-doc-index": "tsx scripts/generate-doc-index.ts all" } } ``` 2. Commit the generated lockfile and use a lockfile-enforcing installation command such as `npm ci`. 3. Invoke the audited local binary through a package script rather than permitting `npx` to download a missing package. 4. Replace the `#!/usr/bin/env npx tsx` shebang with a controlled execution method. 5. Where practical, compile the generator to JavaScript or rewrite it as standard Node.js JavaScript so no runtime TypeScript loader is required. 6. In CI, disable lifecycle scripts where compatible with the dependency model and restrict network access after dependency installation. ]]>
