You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Andrea Cosentino (Jira)" <ji...@apache.org> on 2026/07/08 12:55:00 UTC

[jira] [Assigned] (CAMEL-23942) camel-azure-storage-blob / camel-azure-storage-datalake: contain fileDir downloads within the configured directory

     [ https://issues.apache.org/jira/browse/CAMEL-23942?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrea Cosentino reassigned CAMEL-23942:
----------------------------------------

    Assignee: Andrea Cosentino

> camel-azure-storage-blob / camel-azure-storage-datalake: contain fileDir downloads within the configured directory
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-23942
>                 URL: https://issues.apache.org/jira/browse/CAMEL-23942
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-azure
>            Reporter: Andrea Cosentino
>            Assignee: Andrea Cosentino
>            Priority: Major
>
> The remote-file consumers (camel-file, camel-ftp, camel-smb, camel-mina-sftp) and camel-azure-files contain their local downloads within the configured local directory using a path-segment boundary check -- see the containment behavior added in CAMEL-23765 and made boundary-aware in CAMEL-23868 (GenericFileHelper.isWithinDirectory / jailToLocalWorkDirectory).
> The Azure Storage Blob and DataLake consumers do not apply an equivalent check. When fileDir is configured, the local download target is built directly from the remote object name:
> * BlobOperations.downloadBlobToFile -- new File(fileDir, client.getBlobName()) (BlobOperations.java:156), passed to downloadToFileWithResponse at :164.
> * DataLakeFileOperations.downloadToFile -- new File(fileDir, fileClientWrapper.getFileName()) (DataLakeFileOperations.java:109), passed to downloadToFileWithResponse at :116.
> A remote object name may contain ../ segments, which resolve to a location outside fileDir. For consistency with the rest of the file-download consumer family, the resolved target should be constrained to stay within fileDir.
> Proposed change:
> * Before invoking downloadToFileWithResponse in both operations classes, compact the resolved target path and the configured fileDir, and verify the target remains within fileDir using a path-segment boundary comparison; fail the operation otherwise.
> * These two modules do not depend on camel-file, so GenericFileHelper cannot be reused directly. Either extract the small boundary check into a shared low-level module (e.g. camel-util/camel-support) or replicate the equivalent compact-path boundary check locally in both classes.
> * Add unit tests covering an object name containing ../ segments and asserting the resolved path stays within fileDir.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)