mcp-ssh-manager 4.4.5 → 4.4.6
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/CHANGELOG.md +15 -0
- package/Formula/ssh-manager.rb +2 -2
- package/README.md +7 -5
- package/desktop/electron/main.js +6 -1
- package/desktop/electron/native-menu.mjs +28 -0
- package/desktop/electron/package-lock.json +2 -2
- package/desktop/electron/package.json +1 -1
- package/dist/ui/app.js +104 -104
- package/docs/MIGRATION.md +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
- package/src/xlsx.js +127 -16
package/docs/MIGRATION.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Upgrading from 3.8 to 4.0
|
|
2
2
|
|
|
3
|
-
**4.0 is released, on npm and as a desktop application**; the latest is 4.4.
|
|
3
|
+
**4.0 is released, on npm and as a desktop application**; the latest is 4.4.6 ([release](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.4.6)).
|
|
4
4
|
The last 3.8 release is 3.8.7, for anyone who pins the 3.8 line.
|
|
5
5
|
|
|
6
6
|
The upgrade path preserves headless npm/CLI use. The application, vault import
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-ssh-manager",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.6",
|
|
4
4
|
"mcpName": "io.github.bvisible/mcp-ssh-manager",
|
|
5
5
|
"description": "MCP server for SSH: let AI agents (Claude Code, Codex, any MCP client) run commands, transfer files and manage servers over SSH, with human approval, an encrypted vault and a live audit trail.",
|
|
6
6
|
"main": "src/index.js",
|
package/server.json
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"url": "https://github.com/bvisible/mcp-ssh-manager",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "4.4.
|
|
9
|
+
"version": "4.4.6",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "mcp-ssh-manager",
|
|
14
|
-
"version": "4.4.
|
|
14
|
+
"version": "4.4.6",
|
|
15
15
|
"transport": {
|
|
16
16
|
"type": "stdio"
|
|
17
17
|
},
|
package/src/xlsx.js
CHANGED
|
@@ -108,6 +108,13 @@ function zip(entries) {
|
|
|
108
108
|
return Buffer.concat([...locals, directory, end]);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
/**
|
|
112
|
+
* The most an archive may expand to, all entries together. A server list is a
|
|
113
|
+
* few kilobytes; a few kilobytes of deflate can claim gigabytes, and reading
|
|
114
|
+
* one should fail with a message rather than take the process down with it.
|
|
115
|
+
*/
|
|
116
|
+
const MAX_UNZIPPED_BYTES = 50 * 1024 * 1024;
|
|
117
|
+
|
|
111
118
|
/**
|
|
112
119
|
* Read a ZIP archive into a map of name → contents.
|
|
113
120
|
*
|
|
@@ -115,6 +122,9 @@ function zip(entries) {
|
|
|
115
122
|
* directory is authoritative, and a file whose entries were rewritten in place
|
|
116
123
|
* (which Excel does) can carry stale local headers.
|
|
117
124
|
*
|
|
125
|
+
* The declared uncompressed sizes are checked before anything is inflated, and
|
|
126
|
+
* inflating is capped too, since a declared size is only what the file says.
|
|
127
|
+
*
|
|
118
128
|
* @param {Buffer} buf
|
|
119
129
|
* @returns {Map<string, Buffer>}
|
|
120
130
|
*/
|
|
@@ -131,11 +141,15 @@ function unzip(buf) {
|
|
|
131
141
|
let at = buf.readUInt32LE(end + 16);
|
|
132
142
|
/** @type {Map<string, Buffer>} */
|
|
133
143
|
const files = new Map();
|
|
144
|
+
let budget = MAX_UNZIPPED_BYTES;
|
|
145
|
+
const tooLarge = () => new Error(
|
|
146
|
+
`Archive expands to more than ${MAX_UNZIPPED_BYTES / 1024 / 1024} MB; not a spreadsheet this reads`);
|
|
134
147
|
|
|
135
148
|
for (let i = 0; i < count; i++) {
|
|
136
149
|
if (buf.readUInt32LE(at) !== 0x02014b50) break;
|
|
137
150
|
const method = buf.readUInt16LE(at + 10);
|
|
138
151
|
const compressed = buf.readUInt32LE(at + 20);
|
|
152
|
+
const uncompressed = buf.readUInt32LE(at + 24);
|
|
139
153
|
const nameLength = buf.readUInt16LE(at + 28);
|
|
140
154
|
const extraLength = buf.readUInt16LE(at + 30);
|
|
141
155
|
const commentLength = buf.readUInt16LE(at + 32);
|
|
@@ -150,7 +164,21 @@ function unzip(buf) {
|
|
|
150
164
|
const raw = buf.subarray(dataAt, dataAt + compressed);
|
|
151
165
|
|
|
152
166
|
if (!name.endsWith('/')) {
|
|
153
|
-
|
|
167
|
+
if (uncompressed > budget) throw tooLarge();
|
|
168
|
+
let data;
|
|
169
|
+
if (method === 0) {
|
|
170
|
+
data = Buffer.from(raw);
|
|
171
|
+
} else {
|
|
172
|
+
try {
|
|
173
|
+
data = zlib.inflateRawSync(raw, { maxOutputLength: Math.max(budget, 1) });
|
|
174
|
+
} catch (error) {
|
|
175
|
+
if (/** @type {NodeJS.ErrnoException} */ (error).code === 'ERR_BUFFER_TOO_LARGE') throw tooLarge();
|
|
176
|
+
throw error;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (data.length > budget) throw tooLarge();
|
|
180
|
+
budget -= data.length;
|
|
181
|
+
files.set(name, data);
|
|
154
182
|
}
|
|
155
183
|
at += 46 + nameLength + extraLength + commentLength;
|
|
156
184
|
}
|
|
@@ -184,6 +212,81 @@ function columnOf(reference) {
|
|
|
184
212
|
|
|
185
213
|
/* --------------------------------------------------------------------- read */
|
|
186
214
|
|
|
215
|
+
/*
|
|
216
|
+
* The size of table this reads. A server list is tens of rows and columns; a
|
|
217
|
+
* few bytes can name a cell millions of columns away, and padding every row up
|
|
218
|
+
* to it used all the memory of the process.
|
|
219
|
+
*/
|
|
220
|
+
const MAX_COLUMNS = 1024;
|
|
221
|
+
const MAX_ROWS = 100000;
|
|
222
|
+
const MAX_CELLS = 2000000;
|
|
223
|
+
|
|
224
|
+
const tableTooLarge = () => new Error(
|
|
225
|
+
`Spreadsheet too large: this reads up to ${MAX_ROWS} rows, ${MAX_COLUMNS} columns and ${MAX_CELLS} cells`);
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* What follows each match of `opening`, up to the next one, one piece at a time.
|
|
229
|
+
*
|
|
230
|
+
* @param {string} xml
|
|
231
|
+
* @param {RegExp} opening - A global expression
|
|
232
|
+
*/
|
|
233
|
+
function* sections(xml, opening) {
|
|
234
|
+
let match = opening.exec(xml);
|
|
235
|
+
while (match) {
|
|
236
|
+
const from = opening.lastIndex;
|
|
237
|
+
const next = opening.exec(xml);
|
|
238
|
+
yield xml.slice(from, next ? next.index : xml.length);
|
|
239
|
+
match = next;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Every `<name …>` element of `xml`, found in one pass.
|
|
245
|
+
*
|
|
246
|
+
* A regular expression over the whole text started again from each tag that
|
|
247
|
+
* never closes, so a few hundred kilobytes of `<t>` took minutes to read. This
|
|
248
|
+
* only moves forward.
|
|
249
|
+
*
|
|
250
|
+
* @param {string} xml
|
|
251
|
+
* @param {string} name
|
|
252
|
+
* @returns {Generator<{attributes: string, body: string, closed: boolean}>}
|
|
253
|
+
* `body` is empty for `<name/>`; for an element that never closes it is the
|
|
254
|
+
* rest of the text, and `closed` is false.
|
|
255
|
+
*/
|
|
256
|
+
function* elements(xml, name) {
|
|
257
|
+
const opening = new RegExp(`<${name}(?=[\\s/>])`, 'g');
|
|
258
|
+
const closing = `</${name}>`;
|
|
259
|
+
while (opening.exec(xml)) {
|
|
260
|
+
const from = opening.lastIndex;
|
|
261
|
+
const end = xml.indexOf('>', from);
|
|
262
|
+
if (end < 0) return;
|
|
263
|
+
if (xml[end - 1] === '/') {
|
|
264
|
+
yield { attributes: xml.slice(from, end - 1), body: '', closed: true };
|
|
265
|
+
opening.lastIndex = end + 1;
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
const at = xml.indexOf(closing, end + 1);
|
|
269
|
+
yield { attributes: xml.slice(from, end), body: xml.slice(end + 1, at < 0 ? xml.length : at), closed: at >= 0 };
|
|
270
|
+
if (at < 0) return;
|
|
271
|
+
opening.lastIndex = at + closing.length;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/** The text of a string item or an inline string, which can be split across runs. */
|
|
276
|
+
function textOf(xml) {
|
|
277
|
+
const parts = [];
|
|
278
|
+
for (const run of elements(xml, 't')) {
|
|
279
|
+
if (run.closed) parts.push(unescape(run.body));
|
|
280
|
+
}
|
|
281
|
+
return parts.join('');
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/** What the first `<v>` of a cell holds. */
|
|
285
|
+
function valueOf(xml) {
|
|
286
|
+
for (const value of elements(xml, 'v')) return value.closed ? value.body : '';
|
|
287
|
+
return '';
|
|
288
|
+
}
|
|
289
|
+
|
|
187
290
|
/**
|
|
188
291
|
* Read the first worksheet as rows of strings.
|
|
189
292
|
*
|
|
@@ -199,11 +302,7 @@ export function readSheet(buf) {
|
|
|
199
302
|
const shared = [];
|
|
200
303
|
const sharedXml = files.get('xl/sharedStrings.xml');
|
|
201
304
|
if (sharedXml) {
|
|
202
|
-
for (const item of sharedXml.toString('utf8')
|
|
203
|
-
// A string can be split across runs; concatenate every <t> in the item.
|
|
204
|
-
const parts = [...item.matchAll(/<t[^>]*>([\s\S]*?)<\/t>/g)].map(m => unescape(m[1]));
|
|
205
|
-
shared.push(parts.join(''));
|
|
206
|
-
}
|
|
305
|
+
for (const item of sections(sharedXml.toString('utf8'), /<si[\s>]/g)) shared.push(textOf(item));
|
|
207
306
|
}
|
|
208
307
|
|
|
209
308
|
const sheetName = [...files.keys()].find(name => /^xl\/worksheets\/sheet\d+\.xml$/.test(name));
|
|
@@ -213,31 +312,43 @@ export function readSheet(buf) {
|
|
|
213
312
|
/** @type {string[][]} */
|
|
214
313
|
const rows = [];
|
|
215
314
|
let width = 0;
|
|
315
|
+
// Rows with nothing in them are only kept when a row with a value follows: a
|
|
316
|
+
// sheet formatted far past its table is still the size of its table.
|
|
317
|
+
let blank = 0;
|
|
216
318
|
|
|
217
|
-
for (const rowXml of sheet
|
|
319
|
+
for (const rowXml of sections(sheet, /<row[\s>]/g)) {
|
|
218
320
|
/** @type {string[]} */
|
|
219
321
|
const row = [];
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
const body = cell
|
|
322
|
+
let next = 0;
|
|
323
|
+
for (const cell of elements(rowXml, 'c')) {
|
|
324
|
+
const { attributes, body } = cell;
|
|
223
325
|
const reference = /r="([A-Z]+\d+)"/.exec(attributes)?.[1];
|
|
224
|
-
const index = reference ? columnOf(reference) :
|
|
326
|
+
const index = reference ? columnOf(reference) : next;
|
|
327
|
+
next = index + 1;
|
|
225
328
|
const type = /t="([^"]+)"/.exec(attributes)?.[1];
|
|
226
329
|
|
|
227
330
|
let value = '';
|
|
228
331
|
if (type === 's') {
|
|
229
|
-
const at =
|
|
230
|
-
value = shared[at] ?? '';
|
|
332
|
+
const at = valueOf(body);
|
|
333
|
+
value = /^\d+$/.test(at) ? shared[Number(at)] ?? '' : '';
|
|
231
334
|
} else if (type === 'inlineStr') {
|
|
232
|
-
value =
|
|
335
|
+
value = textOf(body);
|
|
233
336
|
} else {
|
|
234
|
-
value = unescape(
|
|
337
|
+
value = unescape(valueOf(body));
|
|
235
338
|
}
|
|
339
|
+
value = value.trim();
|
|
236
340
|
|
|
341
|
+
// An empty cell, such as one that only carries a style, widens nothing.
|
|
342
|
+
if (!value) continue;
|
|
343
|
+
if (index >= MAX_COLUMNS) throw tableTooLarge();
|
|
237
344
|
while (row.length < index) row.push('');
|
|
238
|
-
row[index] = value
|
|
345
|
+
row[index] = value;
|
|
239
346
|
}
|
|
347
|
+
if (!row.length) { blank++; continue; }
|
|
348
|
+
const count = rows.length + blank + 1;
|
|
240
349
|
width = Math.max(width, row.length);
|
|
350
|
+
if (count > MAX_ROWS || count * width > MAX_CELLS) throw tableTooLarge();
|
|
351
|
+
for (; blank; blank--) rows.push([]);
|
|
241
352
|
rows.push(row);
|
|
242
353
|
}
|
|
243
354
|
|