@devries-cameron20 / composio-1 / commits / 51056129e
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix(core): detect filesystem case sensitivity for uploads (#4036)

This PR: - fixes #4024 - supersedes #4025 with target-filesystem detection instead of unconditional case folding - uses `is-fs-case-sensitive` on the nearest existing directory so mixed mounts and case-sensitive filesystem configurations are handled correctly - preserves exact matching on case-sensitive filesystems and falls back to conservative case-insensitive matching when detection fails - keeps Node-only detection behind `#platform` and mirrors its runtime dependency in `@composio/slim`, preserving the workerd-safe bundle and Slim import - adds focused Node, workerd, and matcher regressions plus an `@composio/core` patch changeset - verifies 1,044 core tests, five CLI upload tests, the Slim build/import smoke, typecheck, build, ATTW, publint, lint, formatting, frozen install, and changeset validation

Alberto Schiabel committed Aug 3, 2026 at 16:32 UTC 51056129ee11131b7f1a5e273abc3c01e7ddd327
11 files changed +172 -35
.changeset/precise-sensitive-path-casing.md new
+5
@@ -0,0 +1,5 @@
1 +---
2 +'@composio/core': patch
3 +---
4 +
5 +Match sensitive upload path segments using the target filesystem's actual case sensitivity so case-insensitive mounts cannot bypass the denylist without over-blocking distinct paths on case-sensitive mounts.
pnpm-lock.yaml
+36 -25
@@ -681,7 +681,7 @@ importers:
681 version: 2.13.0(@modelcontextprotocol/sdk@1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3))
682 '@modelcontextprotocol/sdk':
683 specifier: 'catalog:'
684 - version: 1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3)
684 + version: 1.29.0(@cfworker/json-schema@4.1.1)(supports-color@10.2.2)(zod@4.4.3)
685 dotenv:
686 specifier: 'catalog:'
687 version: 17.4.2
@@ -833,7 +833,7 @@ importers:
833 version: link:../../packages/providers/vercel
834 '@modelcontextprotocol/sdk':
835 specifier: 'catalog:'
836 - version: 1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3)
836 + version: 1.29.0(@cfworker/json-schema@4.1.1)(supports-color@10.2.2)(zod@4.4.3)
837 ai:
838 specifier: 'catalog:'
839 version: 7.0.37(zod@4.4.3)
@@ -886,7 +886,7 @@ importers:
886 version: link:../../packages/providers/openai-agents
887 '@modelcontextprotocol/sdk':
888 specifier: 'catalog:'
889 - version: 1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3)
889 + version: 1.29.0(@cfworker/json-schema@4.1.1)(supports-color@10.2.2)(zod@4.4.3)
890 '@openai/agents':
891 specifier: ^0.13.5
892 version: 0.13.5(@aws-sdk/credential-provider-node@3.972.71)(@cfworker/json-schema@4.1.1)(@smithy/signature-v4@5.6.9)(supports-color@10.2.2)(ws@8.21.1)(zod@4.4.3)
@@ -1087,7 +1087,7 @@ importers:
1087 version: link:../../packages/providers/vercel
1088 '@modelcontextprotocol/sdk':
1089 specifier: 'catalog:'
1090 - version: 1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3)
1090 + version: 1.29.0(@cfworker/json-schema@4.1.1)(supports-color@10.2.2)(zod@4.4.3)
1091 ai:
1092 specifier: 'catalog:'
1093 version: 7.0.37(zod@4.4.3)
@@ -1170,7 +1170,7 @@ importers:
1170 version: 0.61.0(@effect/cluster@0.60.0(@effect/platform@0.97.0(effect@3.22.0))(@effect/rpc@0.76.0(@effect/platform@0.97.0(effect@3.22.0))(effect@3.22.0))(@effect/sql@0.52.0(@effect/experimental@0.61.0(@effect/platform@0.97.0(effect@3.22.0))(effect@3.22.0))(@effect/platform@0.97.0(effect@3.22.0))(effect@3.22.0))(@effect/workflow@0.19.0(@effect/experimental@0.61.0(@effect/platform@0.97.0(effect@3.22.0))(effect@3.22.0))(@effect/platform@0.97.0(effect@3.22.0))(@effect/rpc@0.76.0(@effect/platform@0.97.0(effect@3.22.0))(effect@3.22.0))(effect@3.22.0))(effect@3.22.0))(@effect/platform@0.97.0(effect@3.22.0))(@effect/rpc@0.76.0(@effect/platform@0.97.0(effect@3.22.0))(effect@3.22.0))(@effect/sql@0.52.0(@effect/experimental@0.61.0(@effect/platform@0.97.0(effect@3.22.0))(effect@3.22.0))(@effect/platform@0.97.0(effect@3.22.0))(effect@3.22.0))(effect@3.22.0)
1171 '@modelcontextprotocol/sdk':
1172 specifier: 'catalog:'
1173 - version: 1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3)
1173 + version: 1.29.0(@cfworker/json-schema@4.1.1)(supports-color@10.2.2)(zod@4.4.3)
1174 '@zed-industries/claude-code-acp':
1175 specifier: ^0.16.2
1176 version: 0.16.2(@cfworker/json-schema@4.1.1)(zod@4.4.3)
@@ -1306,7 +1306,7 @@ importers:
1306 version: link:../core
1307 '@modelcontextprotocol/sdk':
1308 specifier: 'catalog:'
1309 - version: 1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3)
1309 + version: 1.29.0(@cfworker/json-schema@4.1.1)(supports-color@10.2.2)(zod@4.4.3)
1310 extract-zip:
1311 specifier: ^2.0.1
1312 version: 2.0.1(supports-color@10.2.2)
@@ -1341,6 +1341,9 @@ importers:
1341 '@types/json-schema':
1342 specifier: ^7.0.15
1343 version: 7.0.15
1344 + is-fs-case-sensitive:
1345 + specifier: ^2.0.0
1346 + version: 2.0.0
1347 openai:
1348 specifier: 'catalog:'
1349 version: 6.49.0(@aws-sdk/credential-provider-node@3.972.71)(@smithy/signature-v4@5.6.9)(ws@8.21.1)(zod@4.4.3)
@@ -1680,6 +1683,9 @@ importers:
1683 '@types/json-schema':
1684 specifier: ^7.0.15
1685 version: 7.0.15
1686 + is-fs-case-sensitive:
1687 + specifier: ^2.0.0
1688 + version: 2.0.0
1689 openai:
1690 specifier: 'catalog:'
1691 version: 6.49.0(@aws-sdk/credential-provider-node@3.972.71)(@smithy/signature-v4@5.6.9)(ws@8.21.1)(zod@4.4.3)
@@ -5145,6 +5151,9 @@ packages:
5151 resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==}
5152 engines: {node: '>=0.10.0'}
5153
5154 + is-fs-case-sensitive@2.0.0:
5155 + resolution: {integrity: sha512-JoCsyGITdYPM+pUbeMQ4IiEuQ4wjPdeWORlG7n644isewbcxiQIr+9gmF5k7UabTP/jLBRkbgydEamR7JZBKHA==}
5156 +
5157 is-fullwidth-code-point@3.0.0:
5158 resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==}
5159 engines: {node: '>=8'}
@@ -7031,7 +7040,7 @@ snapshots:
7040 '@anthropic-ai/claude-agent-sdk@0.3.218(@anthropic-ai/sdk@0.114.0(zod@4.4.3))(@modelcontextprotocol/sdk@1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3))(zod@4.4.3)':
7041 dependencies:
7042 '@anthropic-ai/sdk': 0.114.0(zod@4.4.3)
7034 - '@modelcontextprotocol/sdk': 1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3)
7043 + '@modelcontextprotocol/sdk': 1.29.0(@cfworker/json-schema@4.1.1)(supports-color@10.2.2)(zod@4.4.3)
7044 zod: 4.4.3
7045 optionalDependencies:
7046 '@anthropic-ai/claude-agent-sdk-darwin-arm64': 0.3.218
@@ -7803,7 +7812,7 @@ snapshots:
7812 protobufjs: 7.6.5
7813 ws: 8.21.1
7814 optionalDependencies:
7806 - '@modelcontextprotocol/sdk': 1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3)
7815 + '@modelcontextprotocol/sdk': 1.29.0(@cfworker/json-schema@4.1.1)(supports-color@10.2.2)(zod@4.4.3)
7816 transitivePeerDependencies:
7817 - bufferutil
7818 - supports-color
@@ -7816,7 +7825,7 @@ snapshots:
7825 protobufjs: 7.6.5
7826 ws: 8.21.1
7827 optionalDependencies:
7819 - '@modelcontextprotocol/sdk': 1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3)
7828 + '@modelcontextprotocol/sdk': 1.29.0(@cfworker/json-schema@4.1.1)(supports-color@10.2.2)(zod@4.4.3)
7829 transitivePeerDependencies:
7830 - bufferutil
7831 - supports-color
@@ -8065,7 +8074,7 @@ snapshots:
8074 dependencies:
8075 '@langchain/core': 1.2.3(@opentelemetry/api@1.9.1)(openai@6.49.0(@aws-sdk/credential-provider-node@3.972.71)(@smithy/signature-v4@5.6.9)(ws@8.21.1)(zod@4.4.3))(ws@8.21.1)
8076 '@langchain/langgraph': 1.4.8(@langchain/core@1.2.3(@opentelemetry/api@1.9.1)(openai@6.49.0(@aws-sdk/credential-provider-node@3.972.71)(@smithy/signature-v4@5.6.9)(ws@8.21.1)(zod@4.4.3))(ws@8.21.1))(zod@4.4.3)
8068 - '@modelcontextprotocol/sdk': 1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3)
8077 + '@modelcontextprotocol/sdk': 1.29.0(@cfworker/json-schema@4.1.1)(supports-color@10.2.2)(zod@4.4.3)
8078 debug: 4.4.3(supports-color@10.2.2)
8079 zod: 4.4.3
8080 optionalDependencies:
@@ -8141,7 +8150,7 @@ snapshots:
8150
8151 '@llamaindex/workflow-core@1.3.4(@modelcontextprotocol/sdk@1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3))(hono@4.12.31)(zod@4.4.3)':
8152 optionalDependencies:
8144 - '@modelcontextprotocol/sdk': 1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3)
8153 + '@modelcontextprotocol/sdk': 1.29.0(@cfworker/json-schema@4.1.1)(supports-color@10.2.2)(zod@4.4.3)
8154 hono: 4.12.31
8155 zod: 4.4.3
8156
@@ -8300,7 +8309,7 @@ snapshots:
8309 '@isaacs/ttlcache': 2.1.5
8310 '@lukeed/uuid': 2.0.1
8311 '@mastra/schema-compat': 1.3.4(zod@4.4.3)
8303 - '@modelcontextprotocol/sdk': 1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3)
8312 + '@modelcontextprotocol/sdk': 1.29.0(@cfworker/json-schema@4.1.1)(supports-color@10.2.2)(zod@4.4.3)
8313 '@sindresorhus/slugify': 2.2.1
8314 '@standard-schema/spec': 1.1.0
8315 ajv: 8.20.0
@@ -8351,7 +8360,7 @@ snapshots:
8360 dependencies:
8361 '@mastra/core': 1.52.1(@cfworker/json-schema@4.1.1)(ai@6.0.235(zod@4.4.3))(express@5.2.1)(zod@4.4.3)
8362 '@modelcontextprotocol/ext-apps': 1.7.5(@modelcontextprotocol/sdk@1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3))(zod@4.4.3)
8354 - '@modelcontextprotocol/sdk': 1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3)
8363 + '@modelcontextprotocol/sdk': 1.29.0(@cfworker/json-schema@4.1.1)(supports-color@10.2.2)(zod@4.4.3)
8364 exit-hook: 5.1.0
8365 fast-deep-equal: 3.1.3
8366 transitivePeerDependencies:
@@ -8397,7 +8406,7 @@ snapshots:
8406
8407 '@modelcontextprotocol/ext-apps@1.7.5(@modelcontextprotocol/sdk@1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3))(zod@4.4.3)':
8408 dependencies:
8400 - '@modelcontextprotocol/sdk': 1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3)
8409 + '@modelcontextprotocol/sdk': 1.29.0(@cfworker/json-schema@4.1.1)(supports-color@10.2.2)(zod@4.4.3)
8410 '@standard-schema/spec': 1.1.0
8411 zod: 4.4.3
8412
@@ -8412,7 +8421,7 @@ snapshots:
8421 eventsource: 3.0.7
8422 eventsource-parser: 3.1.0
8423 express: 5.2.1
8415 - express-rate-limit: 8.6.0(express@5.2.1)
8424 + express-rate-limit: 8.6.0(express@5.2.1)(supports-color@10.2.2)
8425 hono: 4.12.31
8426 jose: 6.2.4
8427 json-schema-typed: 8.0.2
@@ -8425,7 +8434,7 @@ snapshots:
8434 transitivePeerDependencies:
8435 - supports-color
8436
8428 - '@modelcontextprotocol/sdk@1.29.0(@cfworker/json-schema@4.1.1)(zod@3.25.76)':
8437 + '@modelcontextprotocol/sdk@1.29.0(@cfworker/json-schema@4.1.1)(supports-color@10.2.2)(zod@4.4.3)':
8438 dependencies:
8439 '@hono/node-server': 2.0.11(hono@4.12.31)
8440 ajv: 8.20.0
@@ -8436,20 +8445,20 @@ snapshots:
8445 eventsource: 3.0.7
8446 eventsource-parser: 3.1.0
8447 express: 5.2.1
8439 - express-rate-limit: 8.6.0(express@5.2.1)
8448 + express-rate-limit: 8.6.0(express@5.2.1)(supports-color@10.2.2)
8449 hono: 4.12.31
8450 jose: 6.2.4
8451 json-schema-typed: 8.0.2
8452 pkce-challenge: 5.0.1
8453 raw-body: 3.0.2
8445 - zod: 3.25.76
8446 - zod-to-json-schema: 3.25.2(zod@3.25.76)
8454 + zod: 4.4.3
8455 + zod-to-json-schema: 3.25.2(zod@4.4.3)
8456 optionalDependencies:
8457 '@cfworker/json-schema': 4.1.1
8458 transitivePeerDependencies:
8459 - supports-color
8460
8452 - '@modelcontextprotocol/sdk@1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3)':
8461 + '@modelcontextprotocol/sdk@1.29.0(@cfworker/json-schema@4.1.1)(zod@3.25.76)':
8462 dependencies:
8463 '@hono/node-server': 2.0.11(hono@4.12.31)
8464 ajv: 8.20.0
@@ -8460,14 +8469,14 @@ snapshots:
8469 eventsource: 3.0.7
8470 eventsource-parser: 3.1.0
8471 express: 5.2.1
8463 - express-rate-limit: 8.6.0(express@5.2.1)
8472 + express-rate-limit: 8.6.0(express@5.2.1)(supports-color@10.2.2)
8473 hono: 4.12.31
8474 jose: 6.2.4
8475 json-schema-typed: 8.0.2
8476 pkce-challenge: 5.0.1
8477 raw-body: 3.0.2
8469 - zod: 4.4.3
8470 - zod-to-json-schema: 3.25.2(zod@4.4.3)
8478 + zod: 3.25.76
8479 + zod-to-json-schema: 3.25.2(zod@3.25.76)
8480 optionalDependencies:
8481 '@cfworker/json-schema': 4.1.1
8482 transitivePeerDependencies:
@@ -8515,7 +8524,7 @@ snapshots:
8524 debug: 4.4.3(supports-color@10.2.2)
8525 openai: 6.49.0(@aws-sdk/credential-provider-node@3.972.71)(@smithy/signature-v4@5.6.9)(ws@8.21.1)(zod@4.4.3)
8526 optionalDependencies:
8518 - '@modelcontextprotocol/sdk': 1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3)
8527 + '@modelcontextprotocol/sdk': 1.29.0(@cfworker/json-schema@4.1.1)(supports-color@10.2.2)(zod@4.4.3)
8528 zod: 4.4.3
8529 transitivePeerDependencies:
8530 - '@aws-sdk/credential-provider-node'
@@ -9879,7 +9888,7 @@ snapshots:
9888
9889 expect-type@1.4.0: {}
9890
9882 - express-rate-limit@8.6.0(express@5.2.1):
9891 + express-rate-limit@8.6.0(express@5.2.1)(supports-color@10.2.2):
9892 dependencies:
9893 debug: 4.4.3(supports-color@10.2.2)
9894 express: 5.2.1
@@ -10237,6 +10246,8 @@ snapshots:
10246
10247 is-extglob@2.1.1: {}
10248
10249 + is-fs-case-sensitive@2.0.0: {}
10250 +
10251 is-fullwidth-code-point@3.0.0: {}
10252
10253 is-glob@4.0.3:
ts/packages/core/package.json
+1
@@ -114,6 +114,7 @@
114 "@composio/client": "catalog:",
115 "@composio/json-schema-to-zod": "workspace:*",
116 "@types/json-schema": "^7.0.15",
117 + "is-fs-case-sensitive": "^2.0.0",
118 "openai": "catalog:",
119 "picocolors": "catalog:",
120 "pusher-js": "^8.6.0",
ts/packages/core/src/platform/node.ts
+40
@@ -1,8 +1,37 @@
1 import * as fs from 'node:fs';
2 import * as os from 'node:os';
3 import * as path from 'node:path';
4 +import { isFsCaseSensitive } from 'is-fs-case-sensitive';
5 import type { Platform, Uint8ArrayEncoding } from './types';
6
7 +const findNearestExistingDirectory = (filePath: string): string => {
8 + let candidate = path.resolve(filePath);
9 +
10 + try {
11 + if (!fs.statSync(candidate).isDirectory()) {
12 + candidate = path.dirname(candidate);
13 + }
14 + } catch {
15 + candidate = path.dirname(candidate);
16 + }
17 +
18 + while (true) {
19 + try {
20 + if (fs.statSync(candidate).isDirectory()) {
21 + return candidate;
22 + }
23 + } catch {
24 + // Walk toward the filesystem root until an existing directory is found.
25 + }
26 +
27 + const parent = path.dirname(candidate);
28 + if (parent === candidate) {
29 + return candidate;
30 + }
31 + candidate = parent;
32 + }
33 +};
34 +
35 /**
36 * Node.js platform implementation.
37 * Provides full file system and OS operations using Node.js built-in modules.
@@ -42,6 +71,17 @@ export const platform = {
71 return fs.realpathSync(filePath);
72 },
73
74 + isFileSystemCaseSensitive(filePath: string): boolean {
75 + try {
76 + return isFsCaseSensitive(findNearestExistingDirectory(filePath));
77 + } catch {
78 + // Detection must not weaken this security guard. If the target mount
79 + // cannot be inspected, compare case-insensitively and accept possible
80 + // false positives instead of allowing a casing bypass.
81 + return false;
82 + }
83 + },
84 +
85 mkdirSync(dirPath: string): void {
86 fs.mkdirSync(dirPath, { recursive: true });
87 },
ts/packages/core/src/platform/types.ts
+9
@@ -52,6 +52,15 @@ export interface Platform {
52 */
53 realpathSync(filePath: string): string;
54
55 + /**
56 + * Returns whether paths on the filesystem containing `filePath` are
57 + * case-sensitive. Node checks the nearest existing directory so the result
58 + * follows the target mount rather than the operating-system default.
59 + * Runtimes without a filesystem return true to preserve exact path matching.
60 + * @param filePath - A file or directory on the filesystem to inspect.
61 + */
62 + isFileSystemCaseSensitive?(filePath: string): boolean;
63 +
64 /**
65 * Creates a directory at the given path, including parent directories if needed.
66 * @param dirPath - The directory path to create.
ts/packages/core/src/platform/workerd.ts
+5
@@ -82,6 +82,11 @@ export const platform: Platform = {
82 return filePath;
83 },
84
85 + isFileSystemCaseSensitive(_filePath: string): boolean {
86 + // Preserve exact matching when there is no filesystem to inspect.
87 + return true;
88 + },
89 +
90 mkdirSync(_dirPath: string): void {
91 // No-op in edge runtimes - directories cannot be created
92 },
ts/packages/core/src/utils/sensitiveFileUploadPaths.ts
+12 -9
@@ -12,7 +12,8 @@ import { ComposioSensitiveFilePathBlockedError } from '../errors/FileModifierErr
12
13 /**
14 * Path segments (a single path component) that indicate a sensitive directory when
15 - * they appear anywhere in a resolved local path. Compared case-insensitively on Windows.
15 + * they appear anywhere in a resolved local path. Matching follows the case sensitivity
16 + * of the filesystem containing that path.
17 */
18 export const BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS: readonly string[] = [
19 '.ssh',
@@ -30,12 +31,10 @@ const SECRET_LIKE_BASENAME = /^(\.env(\.|$)|\.netrc$|\.pgpass$)/i;
31 /** Default SSH private key basenames (public keys like id_rsa.pub are allowed). */
32 const DEFAULT_PRIVATE_KEY_BASENAME = /^id_(rsa|ed25519|ecdsa|dsa|ecdsa_sk)(\.old)?$/i;
33
33 -const isWindows = typeof process !== 'undefined' && process.platform === 'win32';
34 -
34 /**
35 * Returns normalized path segments, resolving symlinks when the path exists.
36 */
38 -function normalizePathSegments(filePath: string): string[] {
37 +function normalizePath(filePath: string): { resolvedPath: string; segments: string[] } {
38 const absolute = platform.resolvePath(filePath);
39 let resolved = absolute;
40 try {
@@ -45,7 +44,10 @@ function normalizePathSegments(filePath: string): string[] {
44 } catch {
45 // If realpath fails (e.g. race), use resolved path
46 }
48 - return resolved.split(/[/\\]+/).filter(Boolean);
47 + return {
48 + resolvedPath: resolved,
49 + segments: resolved.split(/[/\\]+/).filter(Boolean),
50 + };
51 }
52
53 /**
@@ -63,16 +65,17 @@ function getSensitiveFileUploadPathBlockReason(
65 filePath: string,
66 additionalDenySegments?: string[]
67 ): string | null {
66 - const segments = normalizePathSegments(filePath);
68 + const { resolvedPath, segments } = normalizePath(filePath);
69 + const isCaseSensitive = platform.isFileSystemCaseSensitive?.(resolvedPath) ?? true;
70 + const normalizeSegment = (segment: string) => (isCaseSensitive ? segment : segment.toLowerCase());
71 const deny = new Set(
72 [
73 ...BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS,
74 ...(additionalDenySegments ?? []).map(s => s.trim()).filter(Boolean),
71 - ].map(s => (isWindows ? s.toLowerCase() : s))
75 + ].map(normalizeSegment)
76 );
77
74 - // Windows: compare segments case-insensitively; map once instead of toLowerCase per iteration.
75 - const segmentsForMatch = isWindows ? segments.map(s => s.toLowerCase()) : segments;
78 + const segmentsForMatch = isCaseSensitive ? segments : segments.map(normalizeSegment);
79 for (let i = 0; i < segments.length; i++) {
80 if (deny.has(segmentsForMatch[i]!)) {
81 return `path segment "${segments[i]}" is in the sensitive file upload denylist`;
ts/packages/core/test/platform/node.test.ts new
+37
@@ -0,0 +1,37 @@
1 +import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
2 +import * as os from 'node:os';
3 +import * as path from 'node:path';
4 +import { describe, expect, it } from 'vitest';
5 +import { platform } from '../../src/platform/node';
6 +
7 +const invertAsciiCase = (value: string): string =>
8 + [...value]
9 + .map(character => {
10 + const upper = character.toUpperCase();
11 + return character === upper ? character.toLowerCase() : upper;
12 + })
13 + .join('');
14 +
15 +describe('node platform filesystem case detection', () => {
16 + it('detects the target filesystem for existing and not-yet-created paths', () => {
17 + const root = mkdtempSync(path.join(os.tmpdir(), 'composio-case-sensitivity-'));
18 + try {
19 + const probeDirectory = path.join(root, 'CaseProbe');
20 + mkdirSync(probeDirectory);
21 + const existingFile = path.join(probeDirectory, 'config.json');
22 + writeFileSync(existingFile, '{}');
23 +
24 + const caseVariantExists = existsSync(path.join(root, invertAsciiCase('CaseProbe')));
25 + const expected = !caseVariantExists;
26 +
27 + expect(platform.isFileSystemCaseSensitive(existingFile)).toBe(expected);
28 + expect(
29 + platform.isFileSystemCaseSensitive(
30 + path.join(probeDirectory, 'not-created-yet', 'config.json')
31 + )
32 + ).toBe(expected);
33 + } finally {
34 + rmSync(root, { recursive: true, force: true });
35 + }
36 + });
37 +});
ts/packages/core/test/platform/workerd.test.ts
+4
@@ -87,6 +87,10 @@ describe('workerd platform path helpers (js/polynomial-redos regression)', () =>
87 expect(platform.joinPath(allSlashes, `${allSlashes}name.txt${allSlashes}`)).toBe('name.txt');
88 });
89
90 + it('preserves exact path matching when no filesystem is available', () => {
91 + expect(platform.isFileSystemCaseSensitive('/virtual/.Kube/config')).toBe(true);
92 + });
93 +
94 it('rejects backtracking-prone slash-trim regexes at the source level', () => {
95 const source = readFileSync(WORKERD_SOURCE, 'utf8');
96 // Matches an escaped slash immediately followed by a `+`/`*` or a
ts/packages/core/test/utils/sensitiveFileUploadPaths.test.ts
+22 -1
@@ -1,4 +1,4 @@
1 -import { describe, it, expect } from 'vitest';
1 +import { afterEach, describe, it, expect, vi } from 'vitest';
2 import * as path from 'node:path';
3 import * as os from 'node:os';
4 import { mkdtempSync, writeFileSync, symlinkSync, rmSync, mkdirSync } from 'node:fs';
@@ -6,9 +6,14 @@ import {
6 assertSafeFileUploadPath,
7 isBlockedSensitiveFileUploadPath,
8 } from '../../src/utils/sensitiveFileUploadPaths';
9 +import { platform } from '../../src/platform/node';
10 import * as publicApi from '../../src';
11
12 describe('sensitiveFileUploadPaths', () => {
13 + afterEach(() => {
14 + vi.restoreAllMocks();
15 + });
16 +
17 it('allows normal project files', () => {
18 const p = path.join('/tmp', 'composio-test', 'document.pdf');
19 expect(isBlockedSensitiveFileUploadPath(p)).toBe(false);
@@ -49,6 +54,22 @@ describe('sensitiveFileUploadPaths', () => {
54 );
55 });
56
57 + it('matches deny segments without case on a case-insensitive filesystem', () => {
58 + vi.spyOn(platform, 'isFileSystemCaseSensitive').mockReturnValue(false);
59 +
60 + expect(isBlockedSensitiveFileUploadPath('/Users/me/.Kube/config')).toBe(true);
61 + expect(isBlockedSensitiveFileUploadPath('/data/Secrets/x.txt', ['secrets'])).toBe(true);
62 + });
63 +
64 + it('preserves distinct segment casing on a case-sensitive filesystem', () => {
65 + vi.spyOn(platform, 'isFileSystemCaseSensitive').mockReturnValue(true);
66 +
67 + expect(isBlockedSensitiveFileUploadPath('/home/me/.kube/config')).toBe(true);
68 + expect(isBlockedSensitiveFileUploadPath('/home/me/.Kube/config')).toBe(false);
69 + expect(isBlockedSensitiveFileUploadPath('/data/secrets/x.txt', ['secrets'])).toBe(true);
70 + expect(isBlockedSensitiveFileUploadPath('/data/Secrets/x.txt', ['secrets'])).toBe(false);
71 + });
72 +
73 it('is re-exported from the package root for downstream consumers (e.g. @composio/cli)', () => {
74 // The CLI imports the guard from `@composio/core` to share this one denylist
75 // (issue #3746). Lock the public surface so a refactor cannot silently drop it.
ts/packages/slim/package.json
+1
@@ -107,6 +107,7 @@
107 "@composio/client": "catalog:",
108 "@composio/json-schema-to-zod": "workspace:*",
109 "@types/json-schema": "^7.0.15",
110 + "is-fs-case-sensitive": "^2.0.0",
111 "openai": "catalog:",
112 "picocolors": "catalog:",
113 "pusher-js": "^8.6.0",