You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2026/04/27 08:27:16 UTC

(camel-quarkus) branch rectangular-paper created (now 6042272437)

This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a change to branch rectangular-paper
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


      at 6042272437 Add security-policy integration test for CAMEL-23250

This branch includes the following new commits:

     new 6042272437 Add security-policy integration test for CAMEL-23250

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(camel-quarkus) 01/01: Add security-policy integration test for CAMEL-23250

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch rectangular-paper
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 6042272437d42afbc65449ca93df9c10aa85a147
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Mon Apr 27 10:27:00 2026 +0200

    Add security-policy integration test for CAMEL-23250
    
    Tests Camel's security policy enforcement framework in Quarkus,
    verifying warn/fail/allow policies, category overrides, and
    allowed-properties exclusions using process executor pattern.
    
    Co-Authored-By: Claude Opus 4.6 <no...@anthropic.com>
---
 integration-tests/pom.xml                          |   1 +
 integration-tests/security-policy/pom.xml          | 176 +++++++++++++++++++++
 .../camel/quarkus/security/policy/Routes.java      |  28 ++++
 .../src/main/resources/application.properties      |  22 +++
 .../quarkus/security/policy/SecurityPolicyIT.java  |  23 +++
 .../security/policy/SecurityPolicyTest.java        |  82 ++++++++++
 tooling/scripts/test-categories.yaml               |   1 +
 7 files changed, 333 insertions(+)

diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 69704d51cd..305789c582 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -222,6 +222,7 @@
         <module>salesforce</module>
         <module>sap-netweaver</module>
         <module>saxon</module>
+        <module>security-policy</module>
         <module>servicenow</module>
         <module>servlet</module>
         <module>shiro</module>
diff --git a/integration-tests/security-policy/pom.xml b/integration-tests/security-policy/pom.xml
new file mode 100644
index 0000000000..47558f41e7
--- /dev/null
+++ b/integration-tests/security-policy/pom.xml
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-build-parent-it</artifactId>
+        <version>3.35.0-SNAPSHOT</version>
+        <relativePath>../../poms/build-parent-it/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-integration-test-security-policy</artifactId>
+    <name>Camel Quarkus :: Integration Tests :: Security Policy</name>
+
+    <properties>
+        <quarkus.runner.jar>${project.build.directory}/quarkus-app/quarkus-run.jar</quarkus.runner.jar>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-log</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-timer</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-vertx-http</artifactId>
+        </dependency>
+
+        <!-- test dependencies -->
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-integration-tests-process-executor-support</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+
+    <profiles>
+
+        <profile>
+            <id>full</id>
+            <activation>
+                <property>
+                    <name>!quickly</name>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <!-- Move surefire:test to integration-test phase to be able to run
+                             java -jar target/*runner.jar from a test -->
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>default-test</id>
+                                <goals>
+                                    <goal>test</goal>
+                                </goals>
+                                <phase>integration-test</phase>
+                                <configuration>
+                                    <systemPropertyVariables>
+                                        <quarkus.runner>${quarkus.runner.jar}</quarkus.runner>
+                                    </systemPropertyVariables>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+        <profile>
+            <id>native</id>
+            <activation>
+                <property>
+                    <name>native</name>
+                </property>
+            </activation>
+            <properties>
+                <quarkus.native.enabled>true</quarkus.native.enabled>
+                <quarkus.runner.jar>${project.build.directory}/${project.artifactId}-${project.version}-native-image-source-jar/${project.artifactId}-${project.version}-runner.jar</quarkus.runner.jar>
+            </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-failsafe-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>integration-test</goal>
+                                    <goal>verify</goal>
+                                </goals>
+                                <configuration>
+                                    <systemPropertyVariables>
+                                        <quarkus.runner>${project.build.directory}/${project.artifactId}-${project.version}-runner</quarkus.runner>
+                                    </systemPropertyVariables>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>virtualDependencies</id>
+            <activation>
+                <property>
+                    <name>!noVirtualDependencies</name>
+                </property>
+            </activation>
+            <dependencies>
+                <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory -->
+                <dependency>
+                    <groupId>org.apache.camel.quarkus</groupId>
+                    <artifactId>camel-quarkus-log-deployment</artifactId>
+                    <version>${project.version}</version>
+                    <type>pom</type>
+                    <scope>test</scope>
+                    <exclusions>
+                        <exclusion>
+                            <groupId>*</groupId>
+                            <artifactId>*</artifactId>
+                        </exclusion>
+                    </exclusions>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.camel.quarkus</groupId>
+                    <artifactId>camel-quarkus-timer-deployment</artifactId>
+                    <version>${project.version}</version>
+                    <type>pom</type>
+                    <scope>test</scope>
+                    <exclusions>
+                        <exclusion>
+                            <groupId>*</groupId>
+                            <artifactId>*</artifactId>
+                        </exclusion>
+                    </exclusions>
+                </dependency>
+            </dependencies>
+        </profile>
+    </profiles>
+
+</project>
diff --git a/integration-tests/security-policy/src/main/java/org/apache/camel/quarkus/security/policy/Routes.java b/integration-tests/security-policy/src/main/java/org/apache/camel/quarkus/security/policy/Routes.java
new file mode 100644
index 0000000000..bbfd3c7844
--- /dev/null
+++ b/integration-tests/security-policy/src/main/java/org/apache/camel/quarkus/security/policy/Routes.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.security.policy;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class Routes extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        from("timer:tick?repeatCount=1")
+                .log("Timer tick!");
+    }
+}
diff --git a/integration-tests/security-policy/src/main/resources/application.properties b/integration-tests/security-policy/src/main/resources/application.properties
new file mode 100644
index 0000000000..cedaf3de6e
--- /dev/null
+++ b/integration-tests/security-policy/src/main/resources/application.properties
@@ -0,0 +1,22 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+# Terminate after 1 message is generated
+camel.main.duration-max-messages = 1
+
+# This triggers the insecure:dev security category
+camel.main.devConsoleEnabled = true
diff --git a/integration-tests/security-policy/src/test/java/org/apache/camel/quarkus/security/policy/SecurityPolicyIT.java b/integration-tests/security-policy/src/test/java/org/apache/camel/quarkus/security/policy/SecurityPolicyIT.java
new file mode 100644
index 0000000000..1c586f99d3
--- /dev/null
+++ b/integration-tests/security-policy/src/test/java/org/apache/camel/quarkus/security/policy/SecurityPolicyIT.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.security.policy;
+
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+
+@QuarkusIntegrationTest
+class SecurityPolicyIT extends SecurityPolicyTest {
+}
diff --git a/integration-tests/security-policy/src/test/java/org/apache/camel/quarkus/security/policy/SecurityPolicyTest.java b/integration-tests/security-policy/src/test/java/org/apache/camel/quarkus/security/policy/SecurityPolicyTest.java
new file mode 100644
index 0000000000..ed41ab2c1d
--- /dev/null
+++ b/integration-tests/security-policy/src/test/java/org/apache/camel/quarkus/security/policy/SecurityPolicyTest.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.security.policy;
+
+import java.io.IOException;
+import java.util.concurrent.TimeoutException;
+
+import io.quarkus.test.junit.QuarkusTest;
+import org.apache.camel.quarkus.test.support.process.QuarkusProcessExecutor;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
+import org.zeroturnaround.exec.ProcessResult;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+@DisabledIfSystemProperty(named = "quarkus.runner", matches = ".*runner.jar", disabledReason = "https://github.com/apache/camel-quarkus/issues/4218")
+@QuarkusTest
+public class SecurityPolicyTest {
+
+    @Test
+    public void testWarnPolicyAllowsStartup() throws InterruptedException, IOException, TimeoutException {
+        final ProcessResult result = new QuarkusProcessExecutor(new String[] {}).execute();
+
+        assertThat(result.getExitValue()).isEqualTo(0);
+        assertThat(result.outputUTF8()).contains("Timer tick!");
+        assertThat(result.outputUTF8()).contains("SECURITY WARNING");
+    }
+
+    @Test
+    public void testFailPolicyCausesStartupFailure() throws InterruptedException, IOException, TimeoutException {
+        final ProcessResult result = new QuarkusProcessExecutor(
+                new String[] { "-Dcamel.security.policy=fail" }).execute();
+
+        assertThat(result.getExitValue()).isNotEqualTo(0);
+        assertThat(result.outputUTF8()).doesNotContain("Timer tick!");
+        assertThat(result.outputUTF8()).contains("Security policy violations detected");
+    }
+
+    @Test
+    public void testCategoryOverrideAllowsStartup() throws InterruptedException, IOException, TimeoutException {
+        final ProcessResult result = new QuarkusProcessExecutor(
+                new String[] { "-Dcamel.security.policy=fail", "-Dcamel.security.insecure-dev-policy=allow" }).execute();
+
+        assertThat(result.getExitValue()).isEqualTo(0);
+        assertThat(result.outputUTF8()).contains("Timer tick!");
+    }
+
+    @Test
+    public void testAllowedPropertiesExclusion() throws InterruptedException, IOException, TimeoutException {
+        final ProcessResult result = new QuarkusProcessExecutor(
+                new String[] { "-Dcamel.security.policy=fail",
+                        "-Dcamel.security.allowed-properties=camel.main.devConsoleEnabled" })
+                .execute();
+
+        assertThat(result.getExitValue()).isEqualTo(0);
+        assertThat(result.outputUTF8()).contains("Timer tick!");
+    }
+
+    @Test
+    public void testAllowPolicyNoWarnings() throws InterruptedException, IOException, TimeoutException {
+        final ProcessResult result = new QuarkusProcessExecutor(
+                new String[] { "-Dcamel.security.policy=allow" }).execute();
+
+        assertThat(result.getExitValue()).isEqualTo(0);
+        assertThat(result.outputUTF8()).contains("Timer tick!");
+        assertThat(result.outputUTF8()).doesNotContain("SECURITY WARNING");
+    }
+}
diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml
index 7fbc682996..73bae8b7b2 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -196,6 +196,7 @@ group-10:
   - mail
   - main-unknown-args-fail
   - main-unknown-args-ignore
+  - security-policy
   - microprofile-health
   - platform-http-proxy
   - platform-http-proxy-ssl