@composio/core 0.14.0 → 0.14.1
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/dist/{BaseProvider-lCxnjFKQ.d.mts → BaseProvider-Dc5yKZhk.d.mts} +81 -82
- package/dist/{CustomTool-CmokRT9q.d.mts → CustomTool-4nVuwLzO.d.mts} +1 -2
- package/dist/{CustomTool-C_5NvBsX.mjs → CustomTool-l-j5HtEf.mjs} +1 -1
- package/dist/FileModifierErrors-B8V8_3VE.mjs +97 -0
- package/dist/{SsrfErrors-BQRozkeU.mjs → SsrfErrors-DNJt57GL.mjs} +5 -98
- package/dist/{Telemetry-llfvticE.mjs → Telemetry-CF0rNHu2.mjs} +2 -2
- package/dist/{cancellation-W65QRyj2.mjs → cancellation-BbJ-UQ__.mjs} +2 -2
- package/dist/{composio-6C8kHtqc.d.mts → composio-ChU3eD9F.d.mts} +260 -257
- package/dist/{customTool.types-kFhNYuzh.d.mts → customTool.types-CX2-LbfI.d.mts} +142 -109
- package/dist/docs/reference/sdk-reference/typescript/session-files.mdx +2 -0
- package/dist/{errors-B165yJUQ.mjs → errors-BcEUHZbq.mjs} +2 -1
- package/dist/experimental/index.d.mts +2 -2
- package/dist/experimental/index.mjs +1 -1
- package/dist/{fileUtils.node-iPFi2o4i.mjs → fileUtils.node-DOkW4PBg.mjs} +5 -153
- package/dist/index.d.mts +1585 -753
- package/dist/index.mjs +14 -10
- package/dist/models/Files.node.d.mts +2 -11
- package/dist/models/Files.node.mjs +2 -2
- package/dist/models/Files.workerd.d.mts +0 -1
- package/dist/platform/node.d.mts +0 -1
- package/dist/platform/workerd.d.mts +0 -1
- package/dist/platform/workerd.mjs +27 -3
- package/dist/{sensitiveFileUploadPaths-B1OLsd8F.mjs → sensitiveFileUploadPaths-C43dHP7S.mjs} +52 -2
- package/dist/{types-yCrveqAj.d.mts → types-D5N60gUD.d.mts} +2 -3
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -2
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -2
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -2
- package/dist/utils/modifiers/FileToolModifier.node.mjs +5 -4
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -2
- package/dist/utils/ssrfGuard.node.d.mts +22 -0
- package/dist/utils/ssrfGuard.node.mjs +152 -0
- package/dist/utils/ssrfGuard.workerd.d.mts +9 -0
- package/dist/utils/ssrfGuard.workerd.mjs +17 -0
- package/package.json +14 -9
- package/src/errors/SsrfErrors.ts +4 -3
- package/src/models/ToolRouterSessionFileMount.ts +7 -3
- package/src/platform/workerd.ts +30 -3
- package/src/utils/fileUtils.node.ts +2 -2
- package/src/utils/readResponseBody.ts +63 -0
- package/src/utils/ssrfGuard.node.ts +6 -6
- package/src/utils/ssrfGuard.workerd.ts +19 -0
|
@@ -347,109 +347,16 @@ var ComposioError$1 = class ComposioError$1 extends Error {
|
|
|
347
347
|
}
|
|
348
348
|
};
|
|
349
349
|
|
|
350
|
-
//#endregion
|
|
351
|
-
//#region src/errors/FileModifierErrors.ts
|
|
352
|
-
const FileModifierErrorCodes = {
|
|
353
|
-
FILE_UPLOAD_FAILED: "FILE_UPLOAD_FAILED",
|
|
354
|
-
SENSITIVE_FILE_PATH_BLOCKED: "SENSITIVE_FILE_PATH_BLOCKED",
|
|
355
|
-
FILE_UPLOAD_ABORTED: "FILE_UPLOAD_ABORTED",
|
|
356
|
-
FILE_UPLOAD_PATH_NOT_ALLOWED: "FILE_UPLOAD_PATH_NOT_ALLOWED",
|
|
357
|
-
FILE_NOT_FOUND: "FILE_NOT_FOUND"
|
|
358
|
-
};
|
|
359
|
-
var ComposioFileUploadError = class extends ComposioError$1 {
|
|
360
|
-
constructor(message = "Failed to upload file", options = {}) {
|
|
361
|
-
super(message, {
|
|
362
|
-
...options,
|
|
363
|
-
code: options.code ?? FileModifierErrorCodes.FILE_UPLOAD_FAILED,
|
|
364
|
-
possibleFixes: options.possibleFixes || ["Check if the file exists in the location provided"]
|
|
365
|
-
});
|
|
366
|
-
this.name = "ComposioFileUploadError";
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
|
-
/**
|
|
370
|
-
* Thrown when a local file path is refused before upload (sensitive directory or
|
|
371
|
-
* credential-like file name). Subclass of {@link ComposioFileUploadError} so existing
|
|
372
|
-
* `instanceof ComposioFileUploadError` handlers still apply.
|
|
373
|
-
*/
|
|
374
|
-
var ComposioSensitiveFilePathBlockedError = class extends ComposioFileUploadError {
|
|
375
|
-
constructor(message, options = {}) {
|
|
376
|
-
super(message, {
|
|
377
|
-
...options,
|
|
378
|
-
code: FileModifierErrorCodes.SENSITIVE_FILE_PATH_BLOCKED,
|
|
379
|
-
possibleFixes: options.possibleFixes ?? [
|
|
380
|
-
"Use a file outside ~/.ssh, ~/.aws, and other credential locations",
|
|
381
|
-
"Set sensitiveFileUploadProtection: false only if you understand the risk",
|
|
382
|
-
"Add path segments to block with fileUploadPathDenySegments"
|
|
383
|
-
]
|
|
384
|
-
});
|
|
385
|
-
this.name = "ComposioSensitiveFilePathBlockedError";
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
/**
|
|
389
|
-
* Thrown when a `beforeFileUpload` hook returns `false`.
|
|
390
|
-
*/
|
|
391
|
-
var ComposioFileUploadAbortedError = class extends ComposioFileUploadError {
|
|
392
|
-
constructor(message, options = {}) {
|
|
393
|
-
super(message, {
|
|
394
|
-
...options,
|
|
395
|
-
code: FileModifierErrorCodes.FILE_UPLOAD_ABORTED,
|
|
396
|
-
possibleFixes: options.possibleFixes ?? ["Change beforeFileUpload to return a file path to upload, or allow the upload to proceed"]
|
|
397
|
-
});
|
|
398
|
-
this.name = "ComposioFileUploadAbortedError";
|
|
399
|
-
}
|
|
400
|
-
};
|
|
401
|
-
/**
|
|
402
|
-
* Thrown when automatic file upload during tool execution is attempted from a path
|
|
403
|
-
* that is outside the configured {@link ComposioConfig.fileUploadDirs} allowlist.
|
|
404
|
-
*
|
|
405
|
-
* This only fires for auto-upload (enabled via
|
|
406
|
-
* `dangerouslyAllowAutoUploadDownloadFiles: true`). Manual `composio.files.upload()`
|
|
407
|
-
* calls are never subject to this check.
|
|
408
|
-
*/
|
|
409
|
-
var ComposioFileUploadPathNotAllowedError = class extends ComposioFileUploadError {
|
|
410
|
-
constructor(message, options = {}) {
|
|
411
|
-
super(message, {
|
|
412
|
-
...options,
|
|
413
|
-
code: FileModifierErrorCodes.FILE_UPLOAD_PATH_NOT_ALLOWED,
|
|
414
|
-
possibleFixes: options.possibleFixes ?? [
|
|
415
|
-
"Move the file under one of the directories in `fileUploadDirs`",
|
|
416
|
-
"Stage the file under the default upload dir (`~/.composio/temp`)",
|
|
417
|
-
"Add the containing directory to `fileUploadDirs` when constructing Composio",
|
|
418
|
-
"Pass the file by URL or as a File/Blob object instead of a filesystem path"
|
|
419
|
-
]
|
|
420
|
-
});
|
|
421
|
-
this.name = "ComposioFileUploadPathNotAllowedError";
|
|
422
|
-
}
|
|
423
|
-
};
|
|
424
|
-
/**
|
|
425
|
-
* Thrown when a local file path passed for upload does not exist on disk.
|
|
426
|
-
* Provides extra debugging context (resolved absolute path, cwd, allowlist state)
|
|
427
|
-
* to help the caller distinguish between "typo" and "not-allowlisted" failures.
|
|
428
|
-
*/
|
|
429
|
-
var ComposioFileNotFoundError = class extends ComposioFileUploadError {
|
|
430
|
-
constructor(message, options = {}) {
|
|
431
|
-
super(message, {
|
|
432
|
-
...options,
|
|
433
|
-
code: FileModifierErrorCodes.FILE_NOT_FOUND,
|
|
434
|
-
possibleFixes: options.possibleFixes ?? [
|
|
435
|
-
"Double-check the path for typos",
|
|
436
|
-
"Remember relative paths are resolved against process.cwd() at upload time",
|
|
437
|
-
"Verify the file exists and the process has read permission"
|
|
438
|
-
]
|
|
439
|
-
});
|
|
440
|
-
this.name = "ComposioFileNotFoundError";
|
|
441
|
-
}
|
|
442
|
-
};
|
|
443
|
-
|
|
444
350
|
//#endregion
|
|
445
351
|
//#region src/errors/SsrfErrors.ts
|
|
446
352
|
const SsrfErrorCodes = { BLOCKED_INTERNAL_URL: "BLOCKED_INTERNAL_URL" };
|
|
447
353
|
/**
|
|
448
354
|
* Thrown when a URL file input resolves to a private, loopback, link-local, or
|
|
449
355
|
* otherwise internal address, or points at a non-http(s) scheme. Guards against
|
|
450
|
-
* turning
|
|
451
|
-
* execution) into a server-side request forgery
|
|
452
|
-
* infrastructure such as cloud metadata endpoints
|
|
356
|
+
* turning URL-based file uploads (including Tool Router session files and
|
|
357
|
+
* automatic upload during tool execution) into a server-side request forgery
|
|
358
|
+
* (SSRF) probe of internal infrastructure such as cloud metadata endpoints
|
|
359
|
+
* (`169.254.169.254`).
|
|
453
360
|
*/
|
|
454
361
|
var ComposioBlockedInternalUrlError = class extends ComposioError$1 {
|
|
455
362
|
constructor(message = "Refusing to fetch an internal or non-public URL", options = {}) {
|
|
@@ -474,4 +381,4 @@ var ComposioBlockedInternalUrlError = class extends ComposioError$1 {
|
|
|
474
381
|
};
|
|
475
382
|
|
|
476
383
|
//#endregion
|
|
477
|
-
export {
|
|
384
|
+
export { COMPOSIO_DIR as a, DEFAULT_TOOL_ROUTER_SESSION_FILES_MOUNT_ID as c, USER_DATA_FILE_NAME as d, constants_exports as f, logger as i, IS_DEVELOPMENT_OR_CI as l, getEnvsWithPrefix as m, SsrfErrorCodes as n, COMPOSIO_LOG_LEVEL as o, getEnvVariable as p, ComposioError$1 as r, DEFAULT_BASE_URL as s, ComposioBlockedInternalUrlError as t, TEMP_FILES_DIRECTORY_NAME as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { i as logger, p as getEnvVariable, r as ComposioError$1 } from "./SsrfErrors-DNJt57GL.mjs";
|
|
2
|
+
import { l as getRandomUUID } from "./sensitiveFileUploadPaths-C43dHP7S.mjs";
|
|
3
3
|
import { ComposioError } from "@composio/client";
|
|
4
4
|
|
|
5
5
|
//#region src/types/telemetry.types.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { f as ComposioRequestCancelledError, g as JsonSchemaToZodError, h as JsonSchemaRefResolutionError, m as isRequestAbortError } from "./errors-
|
|
1
|
+
import { i as logger } from "./SsrfErrors-DNJt57GL.mjs";
|
|
2
|
+
import { f as ComposioRequestCancelledError, g as JsonSchemaToZodError, h as JsonSchemaRefResolutionError, m as isRequestAbortError } from "./errors-BcEUHZbq.mjs";
|
|
3
3
|
import { t as isPlainObject } from "./FileToolModifier.utils.neutral-B5rT711M.mjs";
|
|
4
4
|
import { jsonSchemaToZod } from "@composio/json-schema-to-zod";
|
|
5
5
|
|