T08 · Insecure Dependencies
Warning
- Location
- scripts/lib/decoder.js:27
- Finding
- Unpinned Remote Package Download and Execution via npx Fallback## Vulnerability Details **File Location**: `scripts/lib/decoder.js`, lines 27–49 **Vulnerability Type**: Unpinned dependency retrieval and execution **Risk Level**: Medium ### Vulnerable Code ```js const args = ['--yes']; if (env.CLOG_DECODER_REGISTRY) args.push('--registry', env.CLOG_DECODER_REGISTRY); args.push(env.CLOG_DECODER_PACKAGE || DEFAULT_PUBLIC_PACKAGE); return { mode: 'npx', command: 'npx', args, description: 'npm decoder fallback', }; } export function decodeFile(inputPath, outputPath, { skillDir, env = process.env, timeoutMs } = {}) { const resolved = resolveDecoderCommand({ skillDir, env }); const result = spawnSync(resolved.command, [...resolved.args, inputPath, outputPath], { env, encoding: 'utf-8', timeout: timeoutMs, }); ``` The fallback is reached from `scripts/analyze-local.js`, lines 172–174: ```js if (inputBinary) { const decodedPath = path.join(runDir, `${path.basename(inputPath)}.log`); decoded = decodeFile(inputPath, decodedPath, { skillDir: SKILL_DIR, timeoutMs: decodeTimeoutMs }); textLogPath = decodedPath; } ``` ### Technical Analysis The decoder resolver expects a vendored executable at `vendor/clog-decoder/dist/cjs/node/cli.js`. The audited project structure does not contain that file; the vendored directory only includes `package.json`. Consequently, analysis of a binary `.clog`, `.xlog`, or other file detected as binary reaches the `npx` fallback. The fallback invokes: ```text npx --yes @tencent/sdk-log-decoder ``` No exact package version or package-integrity digest is specified. The effective executable can therefore change after the Skill has been reviewed. In addition, the inherited `CLOG_DECODER_PACKAGE` and `CLOG_DECODER_REGISTRY` environment variables can replace the package name and registry without source-code changes. `npx` installs and executes the selected package. This crosses a security boundary from processing untrusted log data to executing remotely retrieved dependency ...[truncated 1681 chars]
- Remediation
- ## Remediation Suggestions 1. Include the documented vendored decoder entry point at `vendor/clog-decoder/dist/cjs/node/cli.js` and fail closed if that trusted artifact is missing. 2. Verify the vendored decoder against a maintained cryptographic checksum before execution. 3. If remote fallback must remain available, pin an exact immutable package version rather than resolving the latest package: ```js const DEFAULT_PUBLIC_PACKAGE = '@tencent/sdk-log-decoder@1.0.0'; ``` 4. Enforce package integrity through a lockfile or explicit integrity verification and use a fixed, trusted registry. 5. Do not inherit `CLOG_DECODER_PACKAGE` or `CLOG_DECODER_REGISTRY` by default. Permit overrides only through an explicit trusted configuration mechanism with strict allowlists. 6. Require explicit user authorization before downloading or executing a decoder that is not bundled with the Skill. 7. Run any downloaded decoder in a restricted subprocess or sandbox with minimal filesystem access, a sanitized environment, no unnecessary credentials, and blocked outbound network access. 8. Log the selected decoder mode, exact package version, registry, and verified digest to the analysis manifest for auditability.
