Andrea Cosentino created CAMEL-24627:
----------------------------------------

             Summary: camel-file: resolve symlinks when containing local work 
directory downloads (parity with camel-azure/google-storage)
                 Key: CAMEL-24627
                 URL: https://issues.apache.org/jira/browse/CAMEL-24627
             Project: Camel
          Issue Type: Improvement
          Components: camel-file
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino


Local work directory downloads in the file-based components (camel-file, 
camel-ftp/sftp, camel-smb, camel-mina-sftp, camel-azure-files) are contained 
within the configured localWorkDirectory by 
GenericFileHelper.jailToLocalWorkDirectory, which currently performs a lexical 
path-boundary check only.

CAMEL-24548 / CAMEL-24549 hardened the equivalent containment in 
camel-azure-storage-blob/datalake and camel-google-storage (AzureFileNameHelper 
/ GoogleCloudStorageFileNameHelper) by additionally resolving existing 
filesystem path segments (following symbolic links) before checking that the 
destination stays inside the configured directory.

GenericFileHelper.jailToLocalWorkDirectory should be brought to parity so that 
a symbolic link inside the local work directory that resolves outside of it 
cannot be used to write files elsewhere. Valid nested download paths continue 
to work unchanged.

Affected code: 
components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileHelper.java
 (jailToLocalWorkDirectory). Callers: FtpOperations, SftpOperations, 
SmbOperations, MinaSftpOperations, FilesOperations (azure-files).



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

Reply via email to