[grade=A] DC-082+DC-064: eliminate command injection surface + add Docker resource limits
DC-082: Convert all 6 execSync() calls with template-string interpolation to execFileSync() with argv arrays — no shell parsing of user-controlled input. Files: routes/ca.js (5 calls), src/docker/self-updater.js (1 call). Also removed stale execSync imports (Codex LOW finding). DC-064: Add --memory=512m --memory-swap=1g --cpus=1.5 to docker run in start.sh to prevent container OOM from taking down the host. Codex grade: A (30,783 tokens). All 1539 tests pass.
This commit is contained in:
@@ -16,7 +16,7 @@ const fsp = require('fs').promises;
|
||||
const path = require('path');
|
||||
const crypto = require('crypto');
|
||||
const os = require('os');
|
||||
const { execSync } = require('child_process');
|
||||
const { execFileSync } = require('child_process');
|
||||
const platformPaths = require('../../platform-paths');
|
||||
const isWindows = platformPaths.isWindows;
|
||||
|
||||
@@ -714,7 +714,7 @@ class SelfUpdater extends EventEmitter {
|
||||
await fsp.mkdir(destDir, { recursive: true });
|
||||
// Use tar command (available on Linux, and Git Bash on Windows)
|
||||
try {
|
||||
execSync(`tar xzf "${tarballPath}" -C "${destDir}" --strip-components=1`, { stdio: 'pipe' });
|
||||
execFileSync('tar', ['xzf', tarballPath, '-C', destDir, '--strip-components=1'], { stdio: 'pipe' });
|
||||
} catch (e) {
|
||||
throw new Error('Failed to extract tarball: ' + e.message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user