Skip to content

[backport camel-4.14.x] CAMEL-23765: remote-file consumers - contain localWorkDirectory downloads within the work directory#24220

Merged
oscerd merged 1 commit into
camel-4.14.xfrom
backport/24180-to-camel-4.14.x
Jun 24, 2026
Merged

[backport camel-4.14.x] CAMEL-23765: remote-file consumers - contain localWorkDirectory downloads within the work directory#24220
oscerd merged 1 commit into
camel-4.14.xfrom
backport/24180-to-camel-4.14.x

Conversation

@oscerd

@oscerd oscerd commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Backport of #24180 (CAMEL-23765) to camel-4.14.x.

What

When localWorkDirectory is enabled, the remote-file consumers built the local work file path from the remote file name without ensuring it stayed within the configured work directory — a remote name containing ../ could resolve outside it. A shared GenericFileHelper.jailToLocalWorkDirectory check (compactPath + startsWith, mirroring the file producer's jail) is now applied to the temp and final files, before mkdirs, in FtpOperations, SftpOperations, FilesOperations and SmbOperations. It reuses the existing jailStartingDirectory option (default true).

Scope notes

  • camel-mina-sftp does not exist on camel-4.14.x (added in a later release), so the main PR's MinaSftpOperations change is not applicable here.
  • Source-only backport: the main PR's jailStartingDirectory producercommon relabel and its regenerated metadata are intentionally omitted to keep the maintenance-branch change minimal; the upgrade-guide entry lives on main.

Tests

  • GenericFileHelperTest (2 tests) passes; the 4 components compile on 4.14.8-SNAPSHOT.

Claude Code on behalf of Andrea Cosentino

…oads within the work directory

Backport of #24180 to camel-4.14.x.

When localWorkDirectory was enabled, the remote-file consumers built the local
work file path from the remote file name without ensuring the result stayed
within the configured work directory, so a remote file name containing ../
sequences could resolve to a path outside it. A shared
GenericFileHelper.jailToLocalWorkDirectory containment check (compactPath +
startsWith, mirroring the file producer's jail) is now applied to both the
in-progress temp file and the final file, before mkdirs, in FtpOperations,
SftpOperations, FilesOperations and SmbOperations. It reuses the existing
jailStartingDirectory option (default true).

Note: camel-mina-sftp does not exist on camel-4.14.x (added later), so its
MinaSftpOperations change from the main PR is not applicable here. Source-only
backport: the jailStartingDirectory producer->common label change and its
regenerated metadata are intentionally omitted; the upgrade-guide entry lives on
main.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
oscerd added a commit that referenced this pull request Jun 24, 2026
…4 upgrade guides on main (#24221)

The localWorkDirectory path-traversal containment fix is backported to camel-4.18.x
(#24219) and camel-4.14.x (#24220). Per the backport upgrade-guide policy the
version-specific guide entries live on main; add a note for the new behaviour to the
4_18 and 4_14 guides (the 4_14 entry omits camel-mina-sftp, which does not exist on
that branch).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@oscerd oscerd merged commit 2f0ec28 into camel-4.14.x Jun 24, 2026
3 checks passed
@oscerd oscerd deleted the backport/24180-to-camel-4.14.x branch June 24, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants