terminal-bridge-setup 3.3.3 → 3.3.4

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.
package/bin/setup.mjs CHANGED
@@ -128,8 +128,13 @@ function installProxyDeps() {
128
128
  const registryArg = process.argv.find(a => a.startsWith("--registry="));
129
129
  const baseArgs = ["install", "--no-audit", "--no-fund"];
130
130
  const runNpm = (args) => {
131
- console.log(c.dim(` 运行 npm ${args.join(" ")} ...`));
132
- return spawnSync("npm", args, { cwd: proxyDir, stdio: "inherit" });
131
+ // Windows 的 npm 是 npm.cmd 批处理,spawn 不带 shell 无法启动
132
+ // (表现为"运行 npm install ..."后无任何输出直接失败,实测踩过)。
133
+ // shell:true 下走 cmd 解析;registry 参数先过白名单校验防 shell 注入。
134
+ const safeArgs = args.filter(a =>
135
+ !a.startsWith("--registry=") || /^--registry=https?:\/\/[\w.\-/:]+$/.test(a));
136
+ console.log(c.dim(` 运行 npm ${safeArgs.join(" ")} ...`));
137
+ return spawnSync("npm", safeArgs, { cwd: proxyDir, stdio: "inherit", shell: true });
133
138
  };
134
139
 
135
140
  let result;
@@ -147,9 +152,12 @@ function installProxyDeps() {
147
152
  }
148
153
  }
149
154
 
150
- if (result.status !== 0) {
151
- // 失败时给出明确的排查建议
152
- console.error("");
155
+ if (result.status !== 0 || result.error) {
156
+ if (result.error) {
157
+ console.error(c.red(" ✗ 无法启动 npm:" + result.error.message));
158
+ console.error(c.yellow(` 手动修复:cd "${join(INSTALL_DIR, "proxy")}" && npm install`));
159
+ fail("npm 无法启动");
160
+ }
153
161
  console.error(c.red(" ✗ npm install 失败"));
154
162
  console.error(c.yellow(" 常见原因和解决方法:"));
155
163
  console.error("");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "JumpServer 终端桥接",
4
- "version": "3.3.3",
4
+ "version": "3.3.4",
5
5
  "description": "终端桥接:JumpServer / Arthas / Yearning,让 Agent 能通过浏览器执行命令、收结果与查数据",
6
6
  "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtsnqR6PcFUueZwYria79tVbstvjk+tM7PpvIXILm5xbd6bAdjDIhzg3lsnKioVfvxjfvT+s6vJsiOYa9ojVZyJMFc5m/05TYqr770ovYwQmz0e88fmiy6dUoSulbtKvBCSLbN6OOL7u+ul8ixLZ/HautxSmou/eNgAFPmhE+4UueE7wfCqcgMYvjLvEzlqTVumMW+5LKw9YsRk6WhHPghY1a3MVUn3eQOWXBtQTEUy3wBM3v4wHxLwDeinVOR4f/P87IlUNo84C5DeimoFit0qCj3K04hS8MIYCLCYZc3v9ftRJDJBkAoah6Eaqj7JajbS3KvLR1ctOYfDhubgmURQIDAQAB",
7
7
  "permissions": ["debugger", "tabs", "alarms", "webNavigation", "nativeMessaging", "scripting", "downloads", "storage"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terminal-bridge-setup",
3
- "version": "3.3.3",
3
+ "version": "3.3.4",
4
4
  "description": "一次性安装器:释放终端桥接(JumpServer / Arthas / Yearning)的本地代理 + Chrome 插件,并注册 native messaging host。让 Agent 能通过浏览器 xterm 终端执行命令并拿回输出。",
5
5
  "license": "MIT",
6
6
  "author": "encorearon",