create-principles-disciple 1.120.2 → 1.120.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
import * as os from 'os';
|
|
4
|
-
import {
|
|
4
|
+
import { execFileSync } from 'child_process';
|
|
5
5
|
import semver from 'semver';
|
|
6
6
|
import { sendSuccess, sendError, sendMethodNotAllowed, sendBadRequest, sendNotFound, } from '../utils/response.js';
|
|
7
7
|
import { appendUpdateHistory } from './update-history.js';
|
|
@@ -500,7 +500,9 @@ async function doApplyUpdate(options, workspaceDir) {
|
|
|
500
500
|
const buffer = Buffer.from(await dlResponse.arrayBuffer());
|
|
501
501
|
const tarballPath = path.join(tempDir, 'package.tgz');
|
|
502
502
|
fs.writeFileSync(tarballPath, buffer);
|
|
503
|
-
|
|
503
|
+
// EP-08: spawn tar via argv array — tarball/temp paths stay data, never
|
|
504
|
+
// shell syntax (Mimosa command-injection finding, 2026-08-22).
|
|
505
|
+
execFileSync('tar', ['xzf', tarballPath, '-C', tempDir, '--strip-components=1'], { stdio: 'pipe' });
|
|
504
506
|
fs.unlinkSync(tarballPath);
|
|
505
507
|
// 4. Compute diff and apply.
|
|
506
508
|
// Fix 3: we ONLY apply modified + added files. We deliberately skip ALL
|
|
@@ -748,7 +750,9 @@ async function doInlineFullUpdate(workspaceDir) {
|
|
|
748
750
|
const buffer = Buffer.from(await dlResponse.arrayBuffer());
|
|
749
751
|
const tarballPath = path.join(tempDir, 'package.tgz');
|
|
750
752
|
fs.writeFileSync(tarballPath, buffer);
|
|
751
|
-
|
|
753
|
+
// EP-08: spawn tar via argv array — tarball/temp paths stay data, never
|
|
754
|
+
// shell syntax (Mimosa command-injection finding, 2026-08-22).
|
|
755
|
+
execFileSync('tar', ['xzf', tarballPath, '-C', tempDir, '--strip-components=1'], { stdio: 'pipe' });
|
|
752
756
|
fs.unlinkSync(tarballPath);
|
|
753
757
|
// 4. Detect dependency changes (informational — logged but not blocking;
|
|
754
758
|
// the .js files are still updated; node_modules stays as-is)
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* rc-9: every function returns a structured result instead of throwing.
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
10
|
+
import { execFileSync } from 'child_process';
|
|
11
11
|
import * as fs from 'fs';
|
|
12
12
|
import * as path from 'path';
|
|
13
13
|
import * as os from 'os';
|
|
@@ -78,7 +78,10 @@ export async function checkOpenClawGateway() {
|
|
|
78
78
|
let pid = undefined;
|
|
79
79
|
try {
|
|
80
80
|
if (process.platform === 'win32') {
|
|
81
|
-
|
|
81
|
+
// EP-08: spawn via argv array — no cmd.exe shell in the chain, so even a
|
|
82
|
+
// hostile config value could never be re-interpreted as shell syntax.
|
|
83
|
+
// port is already validated as an integer in readOpenClawPort().
|
|
84
|
+
const output = execFileSync('powershell', ['-NoProfile', '-Command', `(Get-NetTCPConnection -LocalPort ${port} -State Listen -ErrorAction SilentlyContinue).OwningProcess`], { encoding: 'utf-8', timeout: 5000, stdio: ['ignore', 'pipe', 'ignore'] }).trim();
|
|
82
85
|
if (output) {
|
|
83
86
|
const [firstLine] = output.split('\n');
|
|
84
87
|
if (firstLine)
|
|
@@ -86,7 +89,9 @@ export async function checkOpenClawGateway() {
|
|
|
86
89
|
}
|
|
87
90
|
}
|
|
88
91
|
else {
|
|
89
|
-
|
|
92
|
+
// EP-08: argv form replaces the old shell string (which needed
|
|
93
|
+
// `2>/dev/null`); stderr is discarded via stdio instead.
|
|
94
|
+
const output = execFileSync('lsof', ['-i', `:${port}`, '-t', '-sTCP:LISTEN'], { encoding: 'utf-8', timeout: 5000, stdio: ['ignore', 'pipe', 'ignore'] }).trim();
|
|
90
95
|
if (output) {
|
|
91
96
|
const [firstLine] = output.split('\n');
|
|
92
97
|
if (firstLine)
|
|
@@ -107,7 +112,8 @@ export async function checkOpenClawGateway() {
|
|
|
107
112
|
*/
|
|
108
113
|
function runGatewayServiceCommand(subcommand) {
|
|
109
114
|
try {
|
|
110
|
-
|
|
115
|
+
// EP-08: argv array + typed subcommand union — no shell interpolation.
|
|
116
|
+
execFileSync('openclaw', ['gateway', subcommand], { stdio: 'pipe', encoding: 'utf-8', timeout: 15000 });
|
|
111
117
|
return { ok: true };
|
|
112
118
|
}
|
|
113
119
|
catch (e) {
|