ComposioHQ/composio · error · ComposioSensitiveFilePathBlockedError
Refusing to upload: ${reason}. ${remediation}
Error message
Refusing to upload: ${reason}. ${remediation} What it means
Before uploading a local file (e.g. readFileFromDisk / getFileDataAfterUploadingToS3), the SDK inspects the path and refuses to read sensitive locations (.env, SSH keys, cloud credentials, dotfiles, etc.). This ComposioSensitiveFilePathBlockedError lists the reason and a remediation hint.
Source
Thrown at ts/packages/core/src/utils/sensitiveFileUploadPaths.ts:144
* that exposes `sensitiveFileUploadProtection`. Callers without such an opt-out
* (e.g. `@composio/cli`) should pass their own `remediation` so the message does
* not advertise an option the caller cannot honor.
*/
const DEFAULT_REMEDIATION =
`To upload from this path anyway, set sensitiveFileUploadProtection: false on Composio ` +
`(not recommended) or use a copy outside sensitive locations.`;
/**
* @throws {ComposioSensitiveFilePathBlockedError} if the path is not allowed
*/
export function assertSafeFileUploadPath(
filePath: string,
options?: { additionalDenySegments?: string[]; remediation?: string }
): void {
const reason = getSensitiveFileUploadPathBlockReason(filePath, options?.additionalDenySegments);
if (reason) {
const remediation = options?.remediation ?? DEFAULT_REMEDIATION;
throw new ComposioSensitiveFilePathBlockedError(
`Refusing to upload: ${reason}. ${remediation}`,
{
meta: { filePath, reason },
}
);
}
}
View on GitHub (pinned to 64b1b85502)
Solutions
- Point the upload at the actual non-sensitive file you intend to share
- If the file legitimately lives under a flagged-looking name, copy it to a neutral path first and upload that copy
- Never work around the guard by copying credentials — move secrets to environment variables instead
- Pass a custom remediation/additionalDenySegments only if you wrap the API yourself
Example fix
// before
await upload.readFileFromDisk('/myapp/.env');
// after
// .env is intentionally blocked; upload a sanitized config sample instead
await upload.readFileFromDisk('/myapp/config.example.json'); Defensive patterns
Strategy: validation
Validate before calling
const SENSITIVE = [/(^|\/)\.env(/|$)/, /(\.ssh|\.aws|\.gnupg)/, /id_rsa/, /credentials/i];
const looksSensitive = (p: string) => SENSITIVE.some(rx => rx.test(p));
if (looksSensitive(path)) throw new Error('Refusing local sensitive path'); Type guard
null
Try / catch
try {
await upload.readFileFromDisk(path);
} catch (e) {
if (e instanceof ComposioSensitiveFilePathBlockedError) {
// choose a different, non-sensitive file; never bypass
}
} Prevention
- Constrain agent-selectable upload paths to an explicit allowlist directory
- Keep secrets in env vars, not files an agent can reach
- Treat this block as a security control, not a bug to work around
When it happens
Trigger: Passing a file path that contains a denied segment — .env, id_rsa, .aws/credentials, .git config, service account keys, or a path matching the sensitive-path rules (optionally extended by additionalDenySegments).
Common situations: An LLM agent tries to 'upload context' and points at .env or ~/.ssh/id_rsa; tools that default to home-directory dotfiles; CI trying to upload a directory containing credential files.
Related errors
- Refusing to build a path from an unsafe {label}: {value!r}.
- Refusing to write a non-string {label}: {name!r}
- Refusing to write {label} containing a NUL byte: {name!r}
- Refusing to upload: {reason}. Set sensitive_file_upload_prot
- Refusing to fetch a malformed URL
AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28).
Data as JSON: /api/errors/bd9f8baccd7e5890.
Report an issue: GitHub.