You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Andrea Cosentino (Jira)" <ji...@apache.org> on 2026/09/22 12:08:00 UTC
[jira] [Commented] (CAMEL-24893) camel-docling: also constrain absolute paths in custom-argument path validation
[ https://issues.apache.org/jira/browse/CAMEL-24893?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18118001#comment-18118001 ]
Andrea Cosentino commented on CAMEL-24893:
------------------------------------------
Fixed on main (4.23.0) via apache/camel#26738 (commit fd3bc8e73613). Backports to camel-4.22.x and camel-4.18.x will follow via the port labels.
_Claude Code on behalf of Andrea Cosentino (@oscerd)_
> camel-docling: also constrain absolute paths in custom-argument path validation
> -------------------------------------------------------------------------------
>
> Key: CAMEL-24893
> URL: https://issues.apache.org/jira/browse/CAMEL-24893
> Project: Camel
> Issue Type: Improvement
> Components: camel-docling
> Reporter: Andrea Cosentino
> Assignee: Andrea Cosentino
> Priority: Major
> Fix For: 4.23.0
>
>
> DoclingProducer validates path-like values supplied through the CamelDoclingCustomArguments header before appending them to the docling CLI command (validateCustomArguments -> validatePathSafety).
> Currently validatePathSafety only guards against relative traversal: it rejects values containing ../ or ..\ and values whose normalized form still contains a .. element. It does not constrain absolute paths, so an absolute value (e.g. for a flag such as --artifacts-path) passes validation unchanged.
> This is inconsistent with how the component treats input file paths, where resolveWithinInputBaseDirectory() confirms a resolved path stays inside a configured base directory. Custom-argument path values have no equivalent containment.
> Proposed change (in components/camel-ai/camel-docling/src/main/java/org/apache/camel/component/docling/DoclingProducer.java):
> - In validatePathSafety, reject values that are absolute (Paths.get(value).isAbsolute()), or resolve custom-argument path values against a configured safe base directory using the same containment approach as resolveWithinInputBaseDirectory, so any value resolving outside the intended working directory is rejected - covering both relative traversal (already handled) and absolute paths.
> - Add unit tests in DoclingCustomArgsValidationTest for plain absolute-path values in both the "--flag value" and "--flag=value" forms (existing tests cover only relative traversal).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)