create-principles-disciple 1.120.1 → 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 { execSync } from 'child_process';
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
- execSync(`tar xzf "${tarballPath}" -C "${tempDir}" --strip-components=1`, { stdio: 'pipe' });
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
- execSync(`tar xzf "${tarballPath}" -C "${tempDir}" --strip-components=1`, { stdio: 'pipe' });
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 { execSync } from 'child_process';
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
- const output = execSync(`powershell -NoProfile -Command "(Get-NetTCPConnection -LocalPort ${port} -State Listen -ErrorAction SilentlyContinue).OwningProcess"`, { encoding: 'utf-8', timeout: 5000 }).trim();
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
- const output = execSync(`lsof -i :${port} -t -sTCP:LISTEN 2>/dev/null`, { encoding: 'utf-8', timeout: 5000 }).trim();
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
- execSync(`openclaw gateway ${subcommand}`, { stdio: 'pipe', encoding: 'utf-8', timeout: 15000 });
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-principles-disciple",
3
- "version": "1.120.1",
3
+ "version": "1.120.3",
4
4
  "description": "Interactive CLI installer for Principles Disciple OpenClaw plugin",
5
5
  "type": "module",
6
6
  "bin": {
@@ -63,6 +63,6 @@
63
63
  "directory": "packages/create-principles-disciple"
64
64
  },
65
65
  "pd": {
66
- "bundledPluginVersion": "1.216.0"
66
+ "bundledPluginVersion": "1.217.0"
67
67
  }
68
68
  }
@@ -2,7 +2,7 @@
2
2
  "id": "principles-disciple",
3
3
  "name": "Principles Disciple",
4
4
  "description": "Principles Disciple is an AI Agent Governance System. Stop correcting the same AI behavior across sessions. Turn repeated Agent corrections into Owner-approved, observable, reversible behavior principles.",
5
- "version": "1.216.0",
5
+ "version": "1.217.0",
6
6
  "activation": {
7
7
  "onCapabilities": [
8
8
  "hook"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "principles-disciple",
3
- "version": "1.216.0",
3
+ "version": "1.217.0",
4
4
  "description": "Principles Disciple is an AI Agent Governance System. Stop correcting the same AI behavior across sessions. Turn repeated Agent corrections into Owner-approved, observable, reversible behavior principles.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",