[ 
https://issues.apache.org/jira/browse/CAMEL-27453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18149874#comment-18149874
 ] 

Federico Mariani commented on CAMEL-27453:
------------------------------------------

The change also covers two related spots in the remote file components:
- A remote path that contains both a backslash and a parent-directory segment 
is refused by the starting directory check, because the FTP client does not 
treat a backslash as a separator when separator=Auto.
- Stepwise directory changes (camel-ftp, camel-mina-sftp): a path that compacts 
to the current directory no longer changes directory, the parent-directory 
comparison works on whole path segments, and a stepwise recursive poll skips 
listed directory names that are not a single path segment.


> 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-file, camel-ftp
>            Reporter: Federico Mariani
>            Assignee: Guillaume Nodet
>            Priority: Major
>             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