{"record":{"id":"76f1a0529e4c9692","repo":"ComposioHQ/composio","slug":"refusing-to-auto-upload-attempted-resolved-p","errorCode":null,"errorMessage":"Refusing to auto-upload \"${attempted}\": resolved path is not inside any\ndirectory in the configured `fileUploadDirs` allowlist.\n\nPath attempted:   ${attempted}\nResolved to:      ${real}\n${buildHelpFooter(allowlist)}","messagePattern":"Refusing to auto-upload \"(.+?)\": resolved path is not inside any\ndirectory in the configured `fileUploadDirs` allowlist\\.\n\nPath attempted:   (.+?)\nResolved to:      (.+?)\n(.+?)","errorType":"exception","errorClass":"ComposioFileUploadPathNotAllowedError","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/utils/uploadDirAllowlist.node.ts","lineNumber":167,"sourceCode":"        `Resolved to:      ${real}`,\n        '',\n        'Automatic file upload during tool execution is locked down by default',\n        'to prevent a prompt-injected tool from exfiltrating server files',\n        '(source code, .env, SSH keys, etc.).',\n        buildHelpFooter(allowlist),\n      ].join('\\n'),\n      { meta: { attempted, resolved: real, allowlist } }\n    );\n  }\n\n  for (const dir of allowlist) {\n    const realDir = tryRealpath(dir) ?? path.resolve(dir);\n    if (isInsideDir(real, realDir)) {\n      return;\n    }\n  }\n\n  throw new ComposioFileUploadPathNotAllowedError(\n    [\n      `Refusing to auto-upload \"${attempted}\": resolved path is not inside any`,\n      'directory in the configured `fileUploadDirs` allowlist.',\n      '',\n      `Path attempted:   ${attempted}`,\n      `Resolved to:      ${real}`,\n      buildHelpFooter(allowlist),\n    ].join('\\n'),\n    { meta: { attempted, resolved: real, allowlist } }\n  );\n}\n","sourceCodeStart":149,"sourceCodeEnd":179,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/utils/uploadDirAllowlist.node.ts#L149-L179","documentation":"assertPathInsideUploadDirs throws ComposioFileUploadPathNotAllowedError when the file exists but its realpath is not inside any configured fileUploadDirs entry (after symlink resolution via realpath on both sides).","triggerScenarios":"fileUploadDirs is non-empty, the file exists, but it lives outside every allowlisted directory — including cases where a symlink resolves outside the allowlisted dir, or the allowlist entry doesn't match the realpath.","commonSituations":"Allowlist configured with a path that differs from where files actually land (relative vs absolute, symlinked tmp dirs like /var -> /private/var on macOS, Docker volume mounts); overly narrow allowlist.","solutions":["Add the file's actual directory (the 'Resolved to' path's parent) to fileUploadDirs","Use absolute, realpath-resolved paths in the allowlist (fs.realpathSync) to defeat symlink mismatches","Widen deliberately, e.g. add os.tmpdir() if tools write temp files there","Never work around by symlinking files into the allowlisted dir; configure the real location"],"exampleFix":"// before\nnew Composio({ apiKey, fileUploadDirs: ['/tmp'] }); // macOS: /tmp -> /private/tmp\n// after\nnew Composio({ apiKey, fileUploadDirs: [fs.realpathSync('/tmp')] });","handlingStrategy":"validation","validationCode":"import fs from 'node:path';\nfunction isUploadable(p: string, dirs: string[]): boolean {\n  const real = fs.realpathSync(p);\n  return dirs.some((d) => real.startsWith(fs.realpathSync(d) + fs.sep));\n}","typeGuard":null,"tryCatchPattern":"catch (e) { if (e instanceof ComposioFileUploadPathNotAllowedError) { /* add the resolved dir from e.meta.resolved to fileUploadDirs */ } throw e; }","preventionTips":["Use realpath-resolved absolute paths in fileUploadDirs","Place uploadable files in a dedicated allowlisted directory","Remember symlinks are resolved before the allowlist check"],"tags":["file-upload","security","allowlist","symlink"],"backgroundTag":"file-upload-not-allowed","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}