converse-mcp-server 2.9.5 → 2.9.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/package.json +1 -1
- package/src/async/fileCache.js +36 -3
- package/src/providers/openai.js +5 -4
- package/src/tools/checkStatus.js +17 -2
- package/src/utils/idValidation.js +32 -0
package/package.json
CHANGED
package/src/async/fileCache.js
CHANGED
|
@@ -11,6 +11,7 @@ import { promises as fs } from 'fs';
|
|
|
11
11
|
import path from 'path';
|
|
12
12
|
import { debugLog, debugError } from '../utils/console.js';
|
|
13
13
|
import { ConverseMCPError, ERROR_CODES } from '../utils/errorHandler.js';
|
|
14
|
+
import { isSafeIdSegment } from '../utils/idValidation.js';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* File cache specific error class
|
|
@@ -149,6 +150,14 @@ export class FileCache extends FileCacheInterface {
|
|
|
149
150
|
* @private
|
|
150
151
|
*/
|
|
151
152
|
getJobDir(jobId) {
|
|
153
|
+
if (!isSafeIdSegment(jobId)) {
|
|
154
|
+
throw new FileCacheError(
|
|
155
|
+
'Job ID contains unsafe characters',
|
|
156
|
+
ERROR_CODES.VALIDATION_ERROR,
|
|
157
|
+
{ jobId },
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
152
161
|
const today = new Date().toISOString().split('T')[0]; // yyyy-mm-dd
|
|
153
162
|
return path.join(this.baseDir, today, jobId);
|
|
154
163
|
}
|
|
@@ -201,7 +210,15 @@ export class FileCache extends FileCacheInterface {
|
|
|
201
210
|
if (!jobId || typeof jobId !== 'string') {
|
|
202
211
|
throw new FileCacheError(
|
|
203
212
|
'Job ID must be a non-empty string',
|
|
204
|
-
ERROR_CODES.
|
|
213
|
+
ERROR_CODES.VALIDATION_ERROR,
|
|
214
|
+
{ jobId },
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (!isSafeIdSegment(jobId)) {
|
|
219
|
+
throw new FileCacheError(
|
|
220
|
+
'Job ID contains unsafe characters',
|
|
221
|
+
ERROR_CODES.VALIDATION_ERROR,
|
|
205
222
|
{ jobId },
|
|
206
223
|
);
|
|
207
224
|
}
|
|
@@ -265,7 +282,15 @@ export class FileCache extends FileCacheInterface {
|
|
|
265
282
|
if (!jobId || typeof jobId !== 'string') {
|
|
266
283
|
throw new FileCacheError(
|
|
267
284
|
'Job ID must be a non-empty string',
|
|
268
|
-
ERROR_CODES.
|
|
285
|
+
ERROR_CODES.VALIDATION_ERROR,
|
|
286
|
+
{ jobId },
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (!isSafeIdSegment(jobId)) {
|
|
291
|
+
throw new FileCacheError(
|
|
292
|
+
'Job ID contains unsafe characters',
|
|
293
|
+
ERROR_CODES.VALIDATION_ERROR,
|
|
269
294
|
{ jobId },
|
|
270
295
|
);
|
|
271
296
|
}
|
|
@@ -324,7 +349,15 @@ export class FileCache extends FileCacheInterface {
|
|
|
324
349
|
if (!jobId || typeof jobId !== 'string') {
|
|
325
350
|
throw new FileCacheError(
|
|
326
351
|
'Job ID must be a non-empty string',
|
|
327
|
-
ERROR_CODES.
|
|
352
|
+
ERROR_CODES.VALIDATION_ERROR,
|
|
353
|
+
{ jobId },
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (!isSafeIdSegment(jobId)) {
|
|
358
|
+
throw new FileCacheError(
|
|
359
|
+
'Job ID contains unsafe characters',
|
|
360
|
+
ERROR_CODES.VALIDATION_ERROR,
|
|
328
361
|
{ jobId },
|
|
329
362
|
);
|
|
330
363
|
}
|
package/src/providers/openai.js
CHANGED
|
@@ -79,9 +79,9 @@ const SUPPORTED_MODELS = {
|
|
|
79
79
|
'Fastest, most cost-efficient GPT-5 (400K context, 128K output) - Summarization, classification',
|
|
80
80
|
aliases: ['gpt5-nano', 'gpt-5nano', 'gpt 5 nano', 'gpt-5-nano-2025-08-07'],
|
|
81
81
|
},
|
|
82
|
-
'gpt-5-pro': {
|
|
83
|
-
modelName: 'gpt-5-pro',
|
|
84
|
-
friendlyName: 'OpenAI (GPT-5 Pro)',
|
|
82
|
+
'gpt-5.2-pro': {
|
|
83
|
+
modelName: 'gpt-5.2-pro',
|
|
84
|
+
friendlyName: 'OpenAI (GPT-5.2 Pro)',
|
|
85
85
|
contextWindow: 400000,
|
|
86
86
|
maxOutputTokens: 272000,
|
|
87
87
|
supportsStreaming: false, // GPT-5 Pro doesn't support streaming
|
|
@@ -94,11 +94,12 @@ const SUPPORTED_MODELS = {
|
|
|
94
94
|
description:
|
|
95
95
|
'Most advanced reasoning model (400K context, 272K output) - Hardest problems, extended compute time (EXPENSIVE)',
|
|
96
96
|
aliases: [
|
|
97
|
+
'gpt-5-pro',
|
|
97
98
|
'gpt5-pro',
|
|
98
99
|
'gpt-5pro',
|
|
99
100
|
'gpt 5 pro',
|
|
100
101
|
'gpt-5 pro',
|
|
101
|
-
'gpt-5-pro-2025-
|
|
102
|
+
'gpt-5.2-pro-2025-12-11',
|
|
102
103
|
],
|
|
103
104
|
},
|
|
104
105
|
o3: {
|
package/src/tools/checkStatus.js
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
formatJobListHumanReadable,
|
|
18
18
|
formatConversationHistory,
|
|
19
19
|
} from '../utils/formatStatus.js';
|
|
20
|
+
import { isSafeIdSegment } from '../utils/idValidation.js';
|
|
20
21
|
|
|
21
22
|
const logger = createLogger('check-status');
|
|
22
23
|
|
|
@@ -36,8 +37,22 @@ export async function checkStatusTool(args, dependencies) {
|
|
|
36
37
|
const { continuation_id, full_history = false } = args;
|
|
37
38
|
|
|
38
39
|
// Validate arguments
|
|
39
|
-
if (continuation_id
|
|
40
|
-
|
|
40
|
+
if (continuation_id !== undefined) {
|
|
41
|
+
if (typeof continuation_id !== 'string') {
|
|
42
|
+
return createToolError('continuation_id must be a string');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (continuation_id.length === 0) {
|
|
46
|
+
return createToolError(
|
|
47
|
+
'Invalid continuation_id: must be a non-empty string',
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (!isSafeIdSegment(continuation_id)) {
|
|
52
|
+
return createToolError(
|
|
53
|
+
'Invalid continuation_id: contains unsafe characters',
|
|
54
|
+
);
|
|
55
|
+
}
|
|
41
56
|
}
|
|
42
57
|
|
|
43
58
|
const asyncJobStore = getAsyncJobStore();
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ID validation helpers
|
|
3
|
+
*
|
|
4
|
+
* These are intentionally conservative and are primarily used to ensure IDs that
|
|
5
|
+
* are used as filesystem path segments cannot escape their intended directory.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Check whether an ID is safe to use as a single filesystem path segment.
|
|
10
|
+
*
|
|
11
|
+
* Allowed characters: A–Z a–z 0–9 _ -
|
|
12
|
+
* Disallowed: path separators, dots, whitespace, and other punctuation.
|
|
13
|
+
*
|
|
14
|
+
* @param {unknown} id
|
|
15
|
+
* @param {object} [options]
|
|
16
|
+
* @param {number} [options.maxLength]
|
|
17
|
+
* @returns {boolean}
|
|
18
|
+
*/
|
|
19
|
+
export function isSafeIdSegment(id, options = {}) {
|
|
20
|
+
const { maxLength = 128 } = options;
|
|
21
|
+
|
|
22
|
+
if (typeof id !== 'string') {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (id.length === 0 || id.length > maxLength) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return /^[A-Za-z0-9_-]+$/.test(id);
|
|
31
|
+
}
|
|
32
|
+
|