davsclaus opened a new pull request, #29844: URL: https://github.com/apache/camel/pull/29844
_Claude Code on behalf of Claus Ibsen_ ## Description JIRA: [CAMEL-26923](https://issues.apache.org/jira/browse/CAMEL-26923) The `copy` operation of the `duckdb` producer gave the path from the message body to DuckDB's `read_csv`, `read_parquet` or `read_json` as it was. DuckDB interprets that value itself: a value that starts with a URL scheme (`https://`, `s3://`, ...) is read as a remote file, and a value with glob characters (`*`, `?`, `[`, `{`) is expanded to all the matching files. The route had no way to say that `copy` should load one local file, or only files from a given directory. ## Changes - `copy` now loads a single local file by default. A source with a URL scheme or glob characters fails with an `IllegalArgumentException` that names the option to set. This also applies to a `File` or `Path` body whose name has a glob character. - New endpoint options (label `producer,security`): - `allowUrlCopySource` (default `false`, marked `insecure:dev`): pass a source with a URL scheme to DuckDB. - `allowGlobCopySource` (default `false`): let DuckDB expand a glob pattern. - `copyBaseDirectory` (not set by default): a local source must be inside this directory after resolving symbolic links; a relative source is resolved against it. For a glob pattern, the directory before the first glob character must be inside it, and `..` is not accepted. - `duckdb-component.adoc`: new "Copy sources" section, and a pointer to DuckDB's own `enable_external_access`, `allowed_directories` and `autoinstall_known_extensions` settings for limits that cover every statement. - Upgrade guide 4.24: entry for the new default of `copy`. - Regenerated: component JSON, endpoint configurer and URI factory, endpoint DSL builder, catalog JSON and doc copy, and the `SecurityUtils` options map for the new `insecure:dev` option. ## Tests New `DuckDbProducerCopySourceTest` (JUnit 5 + AssertJ, no network access): - a URL source is refused by default, and passed to DuckDB with `allowUrlCopySource=true` (the test connection may not load DuckDB extensions, so nothing is fetched); - a glob pattern is refused by default, and loads all matching files with `allowGlobCopySource=true`; - a `File` / `Path` body whose name has glob characters is refused by default; - with `copyBaseDirectory`: a file inside (absolute or relative) loads; an absolute path outside, a `../` path, a sibling directory with the same name prefix, and symbolic links pointing outside are refused; a glob pattern loads inside the directory and is refused outside it. The existing `DuckDbProducerTest` tests (`copyFromCsvFile`, `copyFromPathBody`, `copyFromBytesBody`, ...) keep passing. With the producer change reverted, 7 of the 9 new tests fail (the 2 that pass are the opt-in cases). `camel-duckdb`: 38 unit tests and 3 integration tests pass; `SecurityUtilsTest` in `camel-util` passes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
