oscerd opened a new pull request, #22767:
URL: https://github.com/apache/camel/pull/22767

   ## Backport of #22082
   
   Cherry-pick of #22082 onto `camel-4.18.x`.
   
   **Original PR:** #22082 - CAMEL-23212: Camel-Docling: Harden CLI argument 
injection validation
   **Original author:** @oscerd
   **Target branch:** `camel-4.18.x`
   
   ### Original description
   
   Switch from blocklist to allowlist approach for custom CLI argument 
validation in DoclingProducer. Define a set of ~55 recognized docling CLI flags 
organized by category (format, pipeline, OCR, tables, PDF, enrichment, output, 
advanced, debug, performance, info). Any flag not in the allowlist is rejected 
with a clear error message.
   
   Add defense-in-depth rejection of shell metacharacters (;, |, `` ` ``, 
`$()`) in all custom argument values, even though ProcessBuilder uses 
list-based invocation and does not interpret them.
   
   Enhance path traversal detection by normalizing path-like values via 
`Path.normalize()` to catch traversal sequences that bypass the literal `../` 
check (e.g., `/safe/subdir/../../etc/passwd`).
   
   Add 8 new unit tests covering semicolon, pipe, backtick, and `$()` injection 
attempts, unknown long/short flag rejection, `-vv` verbosity acceptance, and 
normalized path traversal detection.
   
   Document all allowed custom arguments in `docling-component.adoc`.
   
   ---
   _Backport performed by Claude Code on behalf of Andrea Cosentino._


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to