Federico Mariani created CAMEL-27453:
----------------------------------------

             Summary: camel-file - starting directory check: normalize paths 
without special prefixes
                 Key: CAMEL-27453
                 URL: https://issues.apache.org/jira/browse/CAMEL-27453
             Project: Camel
          Issue Type: Bug
          Components: camel-ftp, camel-file
            Reporter: Federico Mariani
             Fix For: 4.24.0


The starting directory check (jailStartingDirectory) of the remote-file 
consumers and of the file producers normalizes the path with 
FileUtil.compactPath. That general-purpose helper gives some leading prefixes a 
special meaning. For an endpoint without a directory, which works in the login 
directory, this normalization does not match how the FTP client and the server 
resolve the path.

Change:
- Add a lexical normalization to GenericFileHelper that is used only by the 
starting directory check. It treats every path segment alike, without special 
handling of any prefix.
- GenericFileHelper.isWithinDirectory refuses a target that still has a 
parent-directory segment after normalization.
- Use both in RemoteFileConsumer.isWithinStartingDirectory, GenericFileProducer 
(jailStartingDirectory check) and SmbConsumer.

FileUtil.compactPath and the local work directory check are not changed.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to