This is an automated email from the ASF dual-hosted git repository. Croway pushed a commit to branch camel-4.18.x in repository https://gitbox.apache.org/repos/asf/camel.git
commit 2ea5b3b4dfd37bf4f1b04cab7e45809e8831c574 Author: croway <[email protected]> AuthorDate: Mon Nov 23 18:56:35 2026 +0100 CAMEL-27453: camel-ftp - document that a producer without a directory does not restrict absolute file names --- components/camel-ftp/src/main/docs/ftp-component.adoc | 15 +++++++++++++++ components/camel-ftp/src/main/docs/sftp-component.adoc | 15 +++++++++++++++ .../src/main/docs/mina-sftp-component.adoc | 15 +++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/components/camel-ftp/src/main/docs/ftp-component.adoc b/components/camel-ftp/src/main/docs/ftp-component.adoc index e5f93d131972..875e744dcdd0 100644 --- a/components/camel-ftp/src/main/docs/ftp-component.adoc +++ b/components/camel-ftp/src/main/docs/ftp-component.adoc @@ -191,6 +191,21 @@ a line feed cannot be sent as the argument of one command. The `ftp` and `ftps` `GenericFileOperationFailedException` before they send any command for it, for example when the producer writes a file whose `CamelFileName` header has a line break. Remove or replace these characters in the name before the producer. +=== Writing files from an endpoint without a directory + +With `jailStartingDirectory` enabled (the default), the producer writes files within the starting directory of the +endpoint. An endpoint without a directory in its URI, such as `ftp://user@host`, writes into the login directory, +and an absolute file name, such as `/data/out/report.csv`, is written to that absolute path on the server. + +If the file name can come from untrusted input, configure a directory on the endpoint, or reduce the name to a single +path segment, for example with the `flatten` option, which strips any leading path from the file name: + +[source,java] +---- +from("direct:upload") + .to("ftp://user@host/upload?password=secret&flatten=true"); +---- + [[FTP-DefaultWhenConsumingFiles]] === Default when consuming files diff --git a/components/camel-ftp/src/main/docs/sftp-component.adoc b/components/camel-ftp/src/main/docs/sftp-component.adoc index 0761fab775ef..88db7b6b1977 100644 --- a/components/camel-ftp/src/main/docs/sftp-component.adoc +++ b/components/camel-ftp/src/main/docs/sftp-component.adoc @@ -97,6 +97,21 @@ ssh -vvv <server_address> As of Camel 3.18.1, these values can also be set on SFTP endpoints by setting the corresponding URI parameters. +=== Writing files from an endpoint without a directory + +With `jailStartingDirectory` enabled (the default), the producer writes files within the starting directory of the +endpoint. An endpoint without a directory in its URI, such as `sftp://user@host`, writes into the login directory, +and an absolute file name, such as `/data/out/report.csv`, is written to that absolute path on the server. + +If the file name can come from untrusted input, configure a directory on the endpoint, or reduce the name to a single +path segment, for example with the `flatten` option, which strips any leading path from the file name: + +[source,java] +---- +from("direct:upload") + .to("sftp://user@host/upload?password=secret&flatten=true"); +---- + === Symbolic links and the starting directory With `jailStartingDirectory` enabled (the default), the consumer resolves a listed file that the server reports as a diff --git a/components/camel-mina-sftp/src/main/docs/mina-sftp-component.adoc b/components/camel-mina-sftp/src/main/docs/mina-sftp-component.adoc index ab336a87e416..6e3adc9ad450 100644 --- a/components/camel-mina-sftp/src/main/docs/mina-sftp-component.adoc +++ b/components/camel-mina-sftp/src/main/docs/mina-sftp-component.adoc @@ -1500,6 +1500,21 @@ Invalid chmodDirectory value: '888'. Must be an octal number between 000 and 777 This early validation helps catch configuration errors before any file operations are attempted. +== Writing files from an endpoint without a directory + +With `jailStartingDirectory` enabled (the default), the producer writes files within the starting directory of the +endpoint. An endpoint without a directory in its URI, such as `mina-sftp://user@host`, writes into the login directory, +and an absolute file name, such as `/data/out/report.csv`, is written to that absolute path on the server. + +If the file name can come from untrusted input, configure a directory on the endpoint, or reduce the name to a single +path segment, for example with the `flatten` option, which strips any leading path from the file name: + +[source,java] +---- +from("direct:upload") + .to("mina-sftp://user@host/upload?password=secret&flatten=true"); +---- + == Symbolic Links The consumer follows symbolic links to their target files, within the starting directory unless `jailStartingDirectory=false` (see below). The producer writes to symlink targets.
