{"record":{"id":"4cf89b1edd708e65","repo":"ComposioHQ/composio","slug":"refusing-to-upload-reason-set-sensitive-file-u","errorCode":null,"errorMessage":"Refusing to upload: {reason}. Set sensitive_file_upload_protection=False on Composio if you must (not recommended), or use a copy outside sensitive locations.","messagePattern":"Refusing to upload: (.+?)\\. Set sensitive_file_upload_protection=False on Composio if you must \\(not recommended\\), or use a copy outside sensitive locations\\.","errorType":"exception","errorClass":"SensitiveFilePathBlockedError","httpStatus":null,"severity":"error","filePath":"python/composio/utils/sensitive_file_upload_paths.py","lineNumber":98,"sourceCode":"    additional_deny_segments: t.Optional[t.Sequence[str]] = None,\n) -> bool:\n    return _get_block_reason(file_path, additional_deny_segments) is not None\n\n\ndef assert_safe_local_file_upload_path(\n    file_path: t.Union[str, Path],\n    *,\n    enabled: bool = True,\n    additional_deny_segments: t.Optional[t.Sequence[str]] = None,\n) -> None:\n    \"\"\"Raise SensitiveFilePathBlockedError if *file_path* matches the denylist.\"\"\"\n    if not enabled:\n        return\n    reason = _get_block_reason(file_path, additional_deny_segments)\n    if reason:\n        from composio.exceptions import SensitiveFilePathBlockedError\n\n        raise SensitiveFilePathBlockedError(\n            f\"Refusing to upload: {reason}. \"\n            \"Set sensitive_file_upload_protection=False on Composio if you must \"\n            \"(not recommended), or use a copy outside sensitive locations.\"\n        )\n","sourceCodeStart":80,"sourceCodeEnd":103,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/python/composio/utils/sensitive_file_upload_paths.py#L80-L103","documentation":"Raised by assert_safe_local_file_upload_path when the path being uploaded falls inside a known-sensitive location (SSH keys, .env files, credentials, dotfiles, etc.), guarded by _get_block_reason. It's a deliberate guardrail: Composio refuses to auto-upload files from sensitive paths unless the protection is explicitly disabled on the Composio client via sensitive_file_upload_protection=False.","triggerScenarios":"Calling a file-upload API whose path resolves into ~/.ssh/, .aws/, a directory containing .env, a dotfile config, or other deny-listed segments; also triggered when the real path (after symlink resolution) lands in a sensitive directory even if the given path looks benign.","commonSituations":"Agents asked to \"attach the .env\" or upload a workspace containing secrets; symlinked project dirs pointing into home/config areas; CI pipelines uploading from credential-bearing directories; defaults enabled on newer SDK versions surprising existing code.","solutions":["Copy the file to a non-sensitive location (e.g. /tmp/scratch/) and upload the copy, excluding secrets","If the block is a false positive and you accept the risk, construct Composio(..., sensitive_file_upload_protection=False) — not recommended","Check for symlinks: realpath the upload path and confirm it isn't resolving into a sensitive directory","Audit the file for real secrets before overriding the guard"],"exampleFix":"# before\ncomposio.tools.upload(\"~/.ssh/id_rsa\")\n# after\nimport shutil\ntmp = \"/tmp/id_rsa_copy\"\nshutil.copyfile(os.path.expanduser(\"~/.ssh/id_rsa\"), tmp)\ncomposio.tools.upload(tmp)","handlingStrategy":"validation","validationCode":"from composio.utils.sensitive_file_upload_paths import _get_block_reason\ndef safe_to_upload(path, extra=None):\n    return _get_block_reason(path, extra or tuple()) is None","typeGuard":null,"tryCatchPattern":"from composio.exceptions import SensitiveFilePathBlockedError\ntry:\n    composio.tools.upload(p)\nexcept SensitiveFilePathBlockedError as e:\n    p = copy_to_scratch(p)\n    composio.tools.upload(p)","preventionTips":["Stage uploads from a neutral scratch directory, never from credential dirs","realpath() upload paths to expose symlinked sensitive targets","Keep secrets out of directories agents can read; never disable the guard reflexively"],"tags":["file-upload","security","sensitive-files","guardrail"],"backgroundTag":"sensitive-file-upload-blocked","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}