T08 · Insecure Dependencies
Warning
- Location
- examples/example-docker.md:7
- Finding
- Mutable and Unlocked Third-Party Dependencies Permit Supply-Chain Substitution<![CDATA[ ## Vulnerability Details **File Location**: `examples/example-docker.md:7-9`; supporting dependency declarations at `package.json:38-43` and installation instructions at `SKILL.md:41-43` **Vulnerability Type**: Supply-chain exposure through unpinned dependencies **Risk Level**: Medium ### Vulnerable Code `examples/example-docker.md:7-9`: ```dockerfile RUN npm install playwright && npx playwright install chromium COPY . . RUN npm install ``` `package.json:38-43`: ```json "dependencies": { "playwright": "^1.40.0", "dotenv": "^16.0.0" }, "devDependencies": { "standard-version": "^9.5.0" } ``` `SKILL.md:41-43`: ```bash # Install dependencies npm install ``` ### Technical Analysis The project does not include a package lockfile, while its declared dependencies use mutable caret ranges. Consequently, `npm install` can resolve package versions that differ from those reviewed during this audit. The Docker example introduces additional exposure by installing `playwright` without any version constraint and then invoking its CLI through `npx`. This makes the effective build dependent on the state of the package registry at build time. Installation lifecycle scripts and executed package CLIs can run arbitrary code during the image build. The application later loads `playwright` and `dotenv` in the same process that holds `SPIELERPLUS_EMAIL` and `SPIELERPLUS_PASSWORD`. If a resolved dependency were compromised, malicious runtime code could read those credentials and access the authenticated browser session. No evidence indicates that the currently named packages are malicious. The vulnerability is the absence of reproducible dependency resolution and the execution of mutable third-party code. ### Attack Path 1. An attacker compromises a permitted future release of a dependency, its publishing account, or the relevant package-distribution channel. 2. A user follows the documented Docker or Skill installation procedure. 3. `npm install playwrigh ...[truncated 1455 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Generate and commit a reviewed `package-lock.json`. 2. Replace deployment and container-build uses of `npm install` with `npm ci` so installation fails if dependency metadata and the lockfile disagree. 3. Pin direct dependencies to exact reviewed versions instead of mutable caret ranges: ```json "playwright": "1.40.0", "dotenv": "16.0.0" ``` 4. Remove the separate unversioned installation from the Docker example. Install from the lockfile and invoke the project-local binary: ```dockerfile COPY package.json package-lock.json ./ RUN npm ci --omit=dev RUN ./node_modules/.bin/playwright install chromium COPY . . ``` 5. Pin the Docker base image by immutable digest rather than relying only on `node:20-alpine`. 6. Review dependency changes before updating the lockfile and use automated vulnerability and provenance checks in CI. 7. Run build and runtime stages as non-root users with minimal filesystem and network permissions. 8. Avoid exposing credentials during image creation. Supply them only at runtime through a protected secret-management mechanism. 9. Consider allowing outbound runtime traffic only to required SpielerPlus endpoints, reducing the exfiltration capability of a compromised dependency. ]]>
