@probelabs/probe 0.6.0-rc124 → 0.6.0-rc125
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/build/agent/index.js +6 -4
- package/build/agent/probeTool.js +20 -4
- package/cjs/agent/ProbeAgent.cjs +3816 -4283
- package/cjs/index.cjs +3818 -4285
- package/package.json +1 -1
- package/src/agent/probeTool.js +20 -4
package/build/agent/index.js
CHANGED
|
@@ -16001,15 +16001,16 @@ var init_probeTool = __esm({
|
|
|
16001
16001
|
const { directory = ".", workingDirectory } = params;
|
|
16002
16002
|
const baseCwd = workingDirectory || process.cwd();
|
|
16003
16003
|
const secureBaseDir = path6.resolve(baseCwd);
|
|
16004
|
+
const isDependencyPath = directory.startsWith("/dep/") || directory.startsWith("go:") || directory.startsWith("js:") || directory.startsWith("rust:");
|
|
16004
16005
|
let targetDir;
|
|
16005
16006
|
if (path6.isAbsolute(directory)) {
|
|
16006
16007
|
targetDir = path6.resolve(directory);
|
|
16007
|
-
if (!targetDir.startsWith(secureBaseDir + path6.sep) && targetDir !== secureBaseDir) {
|
|
16008
|
+
if (!isDependencyPath && !targetDir.startsWith(secureBaseDir + path6.sep) && targetDir !== secureBaseDir) {
|
|
16008
16009
|
throw new Error(`Path traversal attempt detected. Cannot access directory outside workspace: ${directory}`);
|
|
16009
16010
|
}
|
|
16010
16011
|
} else {
|
|
16011
16012
|
targetDir = path6.resolve(secureBaseDir, directory);
|
|
16012
|
-
if (!targetDir.startsWith(secureBaseDir + path6.sep) && targetDir !== secureBaseDir) {
|
|
16013
|
+
if (!isDependencyPath && !targetDir.startsWith(secureBaseDir + path6.sep) && targetDir !== secureBaseDir) {
|
|
16013
16014
|
throw new Error(`Path traversal attempt detected. Access denied: ${directory}`);
|
|
16014
16015
|
}
|
|
16015
16016
|
}
|
|
@@ -16073,15 +16074,16 @@ var init_probeTool = __esm({
|
|
|
16073
16074
|
}
|
|
16074
16075
|
const baseCwd = workingDirectory || process.cwd();
|
|
16075
16076
|
const secureBaseDir = path6.resolve(baseCwd);
|
|
16077
|
+
const isDependencyPath = directory.startsWith("/dep/") || directory.startsWith("go:") || directory.startsWith("js:") || directory.startsWith("rust:");
|
|
16076
16078
|
let targetDir;
|
|
16077
16079
|
if (path6.isAbsolute(directory)) {
|
|
16078
16080
|
targetDir = path6.resolve(directory);
|
|
16079
|
-
if (!targetDir.startsWith(secureBaseDir + path6.sep) && targetDir !== secureBaseDir) {
|
|
16081
|
+
if (!isDependencyPath && !targetDir.startsWith(secureBaseDir + path6.sep) && targetDir !== secureBaseDir) {
|
|
16080
16082
|
throw new Error(`Path traversal attempt detected. Cannot access directory outside workspace: ${directory}`);
|
|
16081
16083
|
}
|
|
16082
16084
|
} else {
|
|
16083
16085
|
targetDir = path6.resolve(secureBaseDir, directory);
|
|
16084
|
-
if (!targetDir.startsWith(secureBaseDir + path6.sep) && targetDir !== secureBaseDir) {
|
|
16086
|
+
if (!isDependencyPath && !targetDir.startsWith(secureBaseDir + path6.sep) && targetDir !== secureBaseDir) {
|
|
16085
16087
|
throw new Error(`Path traversal attempt detected. Access denied: ${directory}`);
|
|
16086
16088
|
}
|
|
16087
16089
|
}
|
package/build/agent/probeTool.js
CHANGED
|
@@ -224,19 +224,27 @@ export const listFilesTool = {
|
|
|
224
224
|
// Security: Validate path to prevent traversal attacks
|
|
225
225
|
const secureBaseDir = path.resolve(baseCwd);
|
|
226
226
|
|
|
227
|
+
// Check if this is a dependency path that should bypass workspace restrictions
|
|
228
|
+
const isDependencyPath = directory.startsWith('/dep/') ||
|
|
229
|
+
directory.startsWith('go:') ||
|
|
230
|
+
directory.startsWith('js:') ||
|
|
231
|
+
directory.startsWith('rust:');
|
|
232
|
+
|
|
227
233
|
// If directory is absolute, check if it's within the secure base directory
|
|
228
234
|
// If it's relative, resolve it against the secure base directory
|
|
229
235
|
let targetDir;
|
|
230
236
|
if (path.isAbsolute(directory)) {
|
|
231
237
|
targetDir = path.resolve(directory);
|
|
232
238
|
// Check if the absolute path is within the secure base directory
|
|
233
|
-
|
|
239
|
+
// Allow dependency paths to bypass this restriction
|
|
240
|
+
if (!isDependencyPath && !targetDir.startsWith(secureBaseDir + path.sep) && targetDir !== secureBaseDir) {
|
|
234
241
|
throw new Error(`Path traversal attempt detected. Cannot access directory outside workspace: ${directory}`);
|
|
235
242
|
}
|
|
236
243
|
} else {
|
|
237
244
|
targetDir = path.resolve(secureBaseDir, directory);
|
|
238
245
|
// Double-check the resolved path is still within the secure base directory
|
|
239
|
-
|
|
246
|
+
// Allow dependency paths to bypass this restriction
|
|
247
|
+
if (!isDependencyPath && !targetDir.startsWith(secureBaseDir + path.sep) && targetDir !== secureBaseDir) {
|
|
240
248
|
throw new Error(`Path traversal attempt detected. Access denied: ${directory}`);
|
|
241
249
|
}
|
|
242
250
|
}
|
|
@@ -323,19 +331,27 @@ export const searchFilesTool = {
|
|
|
323
331
|
const baseCwd = workingDirectory || process.cwd();
|
|
324
332
|
const secureBaseDir = path.resolve(baseCwd);
|
|
325
333
|
|
|
334
|
+
// Check if this is a dependency path that should bypass workspace restrictions
|
|
335
|
+
const isDependencyPath = directory.startsWith('/dep/') ||
|
|
336
|
+
directory.startsWith('go:') ||
|
|
337
|
+
directory.startsWith('js:') ||
|
|
338
|
+
directory.startsWith('rust:');
|
|
339
|
+
|
|
326
340
|
// If directory is absolute, check if it's within the secure base directory
|
|
327
341
|
// If it's relative, resolve it against the secure base directory
|
|
328
342
|
let targetDir;
|
|
329
343
|
if (path.isAbsolute(directory)) {
|
|
330
344
|
targetDir = path.resolve(directory);
|
|
331
345
|
// Check if the absolute path is within the secure base directory
|
|
332
|
-
|
|
346
|
+
// Allow dependency paths to bypass this restriction
|
|
347
|
+
if (!isDependencyPath && !targetDir.startsWith(secureBaseDir + path.sep) && targetDir !== secureBaseDir) {
|
|
333
348
|
throw new Error(`Path traversal attempt detected. Cannot access directory outside workspace: ${directory}`);
|
|
334
349
|
}
|
|
335
350
|
} else {
|
|
336
351
|
targetDir = path.resolve(secureBaseDir, directory);
|
|
337
352
|
// Double-check the resolved path is still within the secure base directory
|
|
338
|
-
|
|
353
|
+
// Allow dependency paths to bypass this restriction
|
|
354
|
+
if (!isDependencyPath && !targetDir.startsWith(secureBaseDir + path.sep) && targetDir !== secureBaseDir) {
|
|
339
355
|
throw new Error(`Path traversal attempt detected. Access denied: ${directory}`);
|
|
340
356
|
}
|
|
341
357
|
}
|