T08 · Insecure Dependencies
- Location
scripts/lib/decoder.js:27- Finding
Unpinned Remote Package Download and Execution via npx Fallback
- Content
View full analysis
Vulnerability Details
File Location:
scripts/lib/decoder.js, lines 27–49
Vulnerability Type: Unpinned dependency retrieval and execution
Risk Level: MediumVulnerable 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 includespackage.json. Consequently, analysis of a binary.clog,.xlog, or other file detected as binary reaches thenpxfallback.The fallback invokes:
text npx --yes @tencent/sdk-log-decoderNo 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_PACKAGEandCLOG_DECODER_REGISTRYenvironment variables can replace the package name and registry without source-code changes.npxinstalls and executes the selected package. This crosses a security boundary from processing untrusted log data to executing remotely retrieved dependency ...[truncated 1681 chars]- Remediation
View remediation
Remediation Suggestions
- Include the documented vendored decoder entry point at
vendor/clog-decoder/dist/cjs/node/cli.jsand fail closed if that trusted artifact is missing. - Verify the vendored decoder against a maintained cryptographic checksum before execution.
- 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'; - Enforce package integrity through a lockfile or explicit integrity verification and use a fixed, trusted registry.
- Do not inherit
CLOG_DECODER_PACKAGEorCLOG_DECODER_REGISTRYby default. Permit overrides only through an explicit trusted configuration mechanism with strict allowlists. - Require explicit user authorization before downloading or executing a decoder that is not bundled with the Skill.
- 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.
- Log the selected decoder mode, exact package version, registry, and verified digest to the analysis manifest for auditability.
- Include the documented vendored decoder entry point at
