This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 4818dd9756e4 CAMEL-26398: camel-jbang - AI tools: test that a write
through a link to an existing file outside the directory is refused (#30426)
4818dd9756e4 is described below
commit 4818dd9756e48a58cd4963c3af7c0d06d6ae2640
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Nov 19 17:09:12 2026 +0100
CAMEL-26398: camel-jbang - AI tools: test that a write through a link to an
existing file outside the directory is refused (#30426)
AuthoringToolsFilePathsTest already checks a write through a linked
directory
and through a link to nothing. It now also writes through a link to an
existing
file outside the project, and checks that file is unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Claus Ibsen <[email protected]>
---
.../camel/dsl/jbang/core/commands/ai/AuthoringToolsFilePathsTest.java | 3 +++
1 file changed, 3 insertions(+)
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ai/AuthoringToolsFilePathsTest.java
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ai/AuthoringToolsFilePathsTest.java
index e4ce83aa5d88..30957217ee7d 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ai/AuthoringToolsFilePathsTest.java
+++
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ai/AuthoringToolsFilePathsTest.java
@@ -343,12 +343,15 @@ class AuthoringToolsFilePathsTest {
.contains("a symbolic link leads out");
assertThat(error(ctx, "camel_write_file", Map.of("file",
"dangling.yaml", "content", ROUTE)))
.contains("a symbolic link leads out");
+ assertThat(error(ctx, "camel_write_file", Map.of("file",
"linked.yaml", "content", "changed")))
+ .contains("a symbolic link leads out");
assertThat(error(ctx, "camel_write_file",
Map.of("directory", project.resolve("shared/sub").toString(),
"file", "new.yaml", "content", ROUTE)))
.startsWith("No such directory");
assertThat(outside.resolve("new.yaml")).doesNotExist();
assertThat(outside.resolve("created.yaml")).doesNotExist();
assertThat(outside.resolve("sub")).doesNotExist();
+ assertThat(outside.resolve("secret.yaml")).hasContent(ROUTE);
}
@Test