You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "oscerd (via GitHub)" <gi...@apache.org> on 2026/07/23 09:11:17 UTC
[PR] CAMEL-24222: Add camel_dependency_security_audit MCP tool [camel]
oscerd opened a new pull request, #25051:
URL: https://github.com/apache/camel/pull/25051
## Summary
Adds a new MCP tool `camel_dependency_security_audit` that performs security vulnerability analysis on a Camel project's dependencies by cross-referencing them with the Camel security advisory database.
- **Per-artifact CVE matching**: scans declared POM dependencies against known Camel CVEs at the project's version
- **Severity classification**: maps CVE titles to critical/high/medium severity
- **Reachability analysis**: when routes are provided, flags whether a vulnerable artifact is directly used (reachable) or only a transitive dependency
- **Upgrade recommendations**: suggests version upgrades and links to migration tools
- **POM sanitization**: masks credentials before processing (via `PomSanitizer`)
Distinct from `camel_dependency_check` (dependency hygiene) and `camel_security_advisories` (raw CVE listing) — this tool combines both into a project-specific vulnerability audit.
## Test plan
- [x] 7 new tests covering required input, older versions with CVEs, current versions, reachability, sanitization, recommendations, empty routes
- [x] All 307 existing MCP server tests pass (no regressions)
_Claude Code on behalf of oscerd_
🤖 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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24222: Add camel_dependency_security_audit MCP tool [camel]
Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd commented on code in PR #25051:
URL: https://github.com/apache/camel/pull/25051#discussion_r3655533680
##########
dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditTools.java:
##########
@@ -0,0 +1,260 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+
+import io.quarkiverse.mcp.server.Tool;
+import io.quarkiverse.mcp.server.ToolArg;
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.tooling.model.ComponentModel;
+import org.apache.camel.tooling.model.SecurityAdvisoryModel;
+
+/**
+ * MCP Tool for performing security vulnerability analysis on Camel project dependencies.
+ * <p>
+ * Distinct from {@link DependencyCheckTools} (dependency hygiene) and {@link AdvisoryTools} (Camel CVE listing), this
+ * tool cross-references a project's declared dependencies with the Camel security advisory database and component
+ * metadata to produce actionable vulnerability findings per artifact.
+ */
+@ApplicationScoped
+public class DependencySecurityAuditTools {
+
+ @Inject
+ CatalogService catalogService;
+
+ @Inject
+ AdvisoryService advisoryService;
+
+ @Tool(annotations = @Tool.Annotations(readOnlyHint = true, destructiveHint = false, openWorldHint = false),
+ description = "Perform a security vulnerability audit on a Camel project's dependencies. "
+ + "Cross-references the project's pom.xml dependencies with the Camel security advisory "
+ + "database to identify CVEs affecting each artifact at the project's Camel version. "
+ + "Reports severity, affected version ranges, fixed versions, and whether the vulnerable "
+ + "component is directly used (reachable) or only a transitive dependency. "
+ + "POM content is automatically sanitized to mask sensitive data.")
+ public AuditResult camel_dependency_security_audit(
+ @ToolArg(description = "The pom.xml file content") String pomContent,
+ @ToolArg(description = "Route definitions (YAML, XML, or Java DSL) to determine which components "
+ + "are actually used (for reachability analysis)") String routes,
+ @ToolArg(description = ToolArgDocs.RUNTIME) String runtime,
+ @ToolArg(description = ToolArgDocs.CAMEL_VERSION) String camelVersion,
+ @ToolArg(description = ToolArgDocs.PLATFORM_BOM) String platformBom,
+ @ToolArg(description = "If true (default), mask credentials in POM content") Boolean sanitizePom) {
+
+ if (pomContent == null || pomContent.isBlank()) {
+ throw new ToolCallException("pomContent is required", null);
+ }
+
+ try {
+ PomSanitizer.ProcessedPom processed = PomSanitizer.process(pomContent, sanitizePom);
+ CamelCatalog catalog = catalogService.loadCatalog(runtime, camelVersion, platformBom);
+ MigrationData.PomAnalysis pom = MigrationData.parsePomContent(processed.content());
+
+ String effectiveVersion = pom.camelVersion() != null ? pom.camelVersion() : catalog.getCatalogVersion();
+
+ List<SecurityAdvisoryModel> allAdvisories = advisoryService.advisories();
+
+ List<String> usedSchemes = routes != null && !routes.isBlank()
+ ? extractUsedSchemes(routes) : List.of();
+
+ Map<String, ArtifactAudit> auditByArtifact = new LinkedHashMap<>();
+
+ for (String dep : pom.dependencies()) {
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, dep, null);
+
+ if (!matched.isEmpty()) {
+ boolean reachable = isReachable(dep, usedSchemes, catalog);
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
+ findings.add(new VulnerabilityFinding(
+ adv.cve(),
+ adv.summary(),
+ adv.severity(),
+ adv.affected(),
+ adv.fixed(),
+ adv.url()));
+ }
+ auditByArtifact.put(dep, new ArtifactAudit(dep, reachable, findings));
+ }
+ }
+
+ for (String compName : catalog.findComponentNames()) {
+ ComponentModel model = catalog.componentModel(compName);
+ if (model == null || model.getArtifactId() == null) {
+ continue;
+ }
+ String artifactId = model.getArtifactId();
+ if (auditByArtifact.containsKey(artifactId)) {
+ continue;
+ }
+
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, artifactId, null);
+ if (!matched.isEmpty() && usedSchemes.contains(compName)) {
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
+ findings.add(new VulnerabilityFinding(
+ adv.cve(), adv.summary(), adv.severity(),
+ adv.affected(), adv.fixed(),
+ adv.url()));
+ }
+ auditByArtifact.put(artifactId, new ArtifactAudit(artifactId, true, findings));
+ }
+ }
+
+ List<ArtifactAudit> vulnerableArtifacts = new ArrayList<>(auditByArtifact.values());
+ int totalCves = vulnerableArtifacts.stream().mapToInt(a -> a.findings().size()).sum();
+ long criticalCount = vulnerableArtifacts.stream()
+ .flatMap(a -> a.findings().stream())
+ .filter(f -> "critical".equals(f.severity()) || "high".equals(f.severity()))
+ .count();
Review Comment:
Done in c2179f9 — the severity comparisons now use equalsIgnoreCase, matching AdvisoryService.matchesSeverity(), so uppercase advisory values are counted correctly.\n\n_Claude Code on behalf of Andrea Cosentino (@oscerd)._
##########
dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditTools.java:
##########
@@ -0,0 +1,260 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+
+import io.quarkiverse.mcp.server.Tool;
+import io.quarkiverse.mcp.server.ToolArg;
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.tooling.model.ComponentModel;
+import org.apache.camel.tooling.model.SecurityAdvisoryModel;
+
+/**
+ * MCP Tool for performing security vulnerability analysis on Camel project dependencies.
+ * <p>
+ * Distinct from {@link DependencyCheckTools} (dependency hygiene) and {@link AdvisoryTools} (Camel CVE listing), this
+ * tool cross-references a project's declared dependencies with the Camel security advisory database and component
+ * metadata to produce actionable vulnerability findings per artifact.
+ */
+@ApplicationScoped
+public class DependencySecurityAuditTools {
+
+ @Inject
+ CatalogService catalogService;
+
+ @Inject
+ AdvisoryService advisoryService;
+
+ @Tool(annotations = @Tool.Annotations(readOnlyHint = true, destructiveHint = false, openWorldHint = false),
+ description = "Perform a security vulnerability audit on a Camel project's dependencies. "
+ + "Cross-references the project's pom.xml dependencies with the Camel security advisory "
+ + "database to identify CVEs affecting each artifact at the project's Camel version. "
+ + "Reports severity, affected version ranges, fixed versions, and whether the vulnerable "
+ + "component is directly used (reachable) or only a transitive dependency. "
+ + "POM content is automatically sanitized to mask sensitive data.")
+ public AuditResult camel_dependency_security_audit(
+ @ToolArg(description = "The pom.xml file content") String pomContent,
+ @ToolArg(description = "Route definitions (YAML, XML, or Java DSL) to determine which components "
+ + "are actually used (for reachability analysis)") String routes,
+ @ToolArg(description = ToolArgDocs.RUNTIME) String runtime,
+ @ToolArg(description = ToolArgDocs.CAMEL_VERSION) String camelVersion,
+ @ToolArg(description = ToolArgDocs.PLATFORM_BOM) String platformBom,
+ @ToolArg(description = "If true (default), mask credentials in POM content") Boolean sanitizePom) {
+
+ if (pomContent == null || pomContent.isBlank()) {
+ throw new ToolCallException("pomContent is required", null);
+ }
+
+ try {
+ PomSanitizer.ProcessedPom processed = PomSanitizer.process(pomContent, sanitizePom);
+ CamelCatalog catalog = catalogService.loadCatalog(runtime, camelVersion, platformBom);
+ MigrationData.PomAnalysis pom = MigrationData.parsePomContent(processed.content());
+
+ String effectiveVersion = pom.camelVersion() != null ? pom.camelVersion() : catalog.getCatalogVersion();
+
+ List<SecurityAdvisoryModel> allAdvisories = advisoryService.advisories();
+
+ List<String> usedSchemes = routes != null && !routes.isBlank()
+ ? extractUsedSchemes(routes) : List.of();
+
+ Map<String, ArtifactAudit> auditByArtifact = new LinkedHashMap<>();
+
+ for (String dep : pom.dependencies()) {
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, dep, null);
+
+ if (!matched.isEmpty()) {
+ boolean reachable = isReachable(dep, usedSchemes, catalog);
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
+ findings.add(new VulnerabilityFinding(
+ adv.cve(),
+ adv.summary(),
+ adv.severity(),
+ adv.affected(),
+ adv.fixed(),
+ adv.url()));
+ }
+ auditByArtifact.put(dep, new ArtifactAudit(dep, reachable, findings));
+ }
+ }
+
+ for (String compName : catalog.findComponentNames()) {
+ ComponentModel model = catalog.componentModel(compName);
+ if (model == null || model.getArtifactId() == null) {
+ continue;
+ }
+ String artifactId = model.getArtifactId();
+ if (auditByArtifact.containsKey(artifactId)) {
+ continue;
+ }
+
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, artifactId, null);
+ if (!matched.isEmpty() && usedSchemes.contains(compName)) {
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
+ findings.add(new VulnerabilityFinding(
+ adv.cve(), adv.summary(), adv.severity(),
+ adv.affected(), adv.fixed(),
+ adv.url()));
+ }
+ auditByArtifact.put(artifactId, new ArtifactAudit(artifactId, true, findings));
+ }
+ }
+
+ List<ArtifactAudit> vulnerableArtifacts = new ArrayList<>(auditByArtifact.values());
+ int totalCves = vulnerableArtifacts.stream().mapToInt(a -> a.findings().size()).sum();
+ long criticalCount = vulnerableArtifacts.stream()
+ .flatMap(a -> a.findings().stream())
+ .filter(f -> "critical".equals(f.severity()) || "high".equals(f.severity()))
+ .count();
+ long reachableCount = vulnerableArtifacts.stream().filter(ArtifactAudit::reachable).count();
+
+ List<String> recommendations = buildRecommendations(vulnerableArtifacts, effectiveVersion, catalog);
+
+ AuditSummary summary = new AuditSummary(
+ effectiveVersion,
+ pom.dependencies().size(),
+ vulnerableArtifacts.size(),
+ totalCves,
+ (int) criticalCount,
+ (int) reachableCount,
+ totalCves == 0);
+
+ return new AuditResult(
+ processed.warnings().isEmpty() ? null : processed.warnings(),
+ vulnerableArtifacts.isEmpty() ? null : vulnerableArtifacts,
+ recommendations.isEmpty() ? null : recommendations,
+ summary);
+
+ } catch (ToolCallException e) {
+ throw e;
+ } catch (Throwable e) {
+ throw new ToolCallException(
+ "Failed to audit dependencies (" + e.getClass().getName() + "): " + e.getMessage(), null);
+ }
+ }
+
+ private List<String> extractUsedSchemes(String routes) {
+ List<String> schemes = new ArrayList<>();
+ String lower = routes.toLowerCase();
+ for (String token : lower.split("[^a-z0-9-]+")) {
+ if (token.length() > 2 && lower.contains(token + ":")) {
+ if (!schemes.contains(token)) {
+ schemes.add(token);
+ }
+ }
+ }
+ return schemes;
+ }
+
+ private boolean isReachable(String artifactId, List<String> usedSchemes, CamelCatalog catalog) {
+ if (usedSchemes.isEmpty()) {
+ return true;
+ }
+ for (String scheme : usedSchemes) {
+ ComponentModel model = catalog.componentModel(scheme);
+ if (model != null && artifactId.equals(model.getArtifactId())) {
+ return true;
+ }
+ }
+ String schemeName = artifactId.replace("camel-", "");
+ return usedSchemes.contains(schemeName);
+ }
+
+ private List<String> buildRecommendations(
+ List<ArtifactAudit> vulnerableArtifacts, String version, CamelCatalog catalog) {
+ List<String> recs = new ArrayList<>();
+
+ boolean hasCritical = vulnerableArtifacts.stream()
+ .flatMap(a -> a.findings().stream())
+ .anyMatch(f -> "critical".equals(f.severity()));
Review Comment:
Done in c2179f9 — the severity comparisons now use equalsIgnoreCase, matching AdvisoryService.matchesSeverity(), so uppercase advisory values are counted correctly.\n\n_Claude Code on behalf of Andrea Cosentino (@oscerd)._
##########
dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditToolsTest.java:
##########
@@ -0,0 +1,150 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+class DependencySecurityAuditToolsTest {
+
+ private static final String SIMPLE_POM = """
+ <project>
+ <properties>
+ <camel.version>4.10.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-http</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private static final String CURRENT_VERSION_POM = """
+ <project>
+ <properties>
+ <camel.version>4.22.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private final DependencySecurityAuditTools tools = createTools();
+
+ private static DependencySecurityAuditTools createTools() {
+ DependencySecurityAuditTools t = new DependencySecurityAuditTools();
+ t.catalogService = new CatalogService();
+ t.advisoryService = new AdvisoryService();
+ return t;
+ }
+
+ @Test
+ void shouldRequirePomContent() {
+ assertThatThrownBy(() -> tools.camel_dependency_security_audit(null, null, null, null, null, null))
+ .isInstanceOf(ToolCallException.class)
+ .hasMessageContaining("pomContent is required");
+ }
+
+ @Test
+ void shouldAuditOlderVersionWithKnownCves() {
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(SIMPLE_POM, null, null, null, null, null);
+
+ assertThat(result).isNotNull();
Review Comment:
Done in c2179f9 — shouldAuditOlderVersionWithKnownCves now asserts totalCves() > 0 so it fails if matching returns nothing.\n\n_Claude Code on behalf of Andrea Cosentino (@oscerd)._
##########
dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditToolsTest.java:
##########
@@ -0,0 +1,151 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+class DependencySecurityAuditToolsTest {
+
+ private static final String SIMPLE_POM = """
+ <project>
+ <properties>
+ <camel.version>4.10.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-http</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private static final String CURRENT_VERSION_POM = """
+ <project>
+ <properties>
+ <camel.version>4.22.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private final DependencySecurityAuditTools tools = createTools();
+
+ private static DependencySecurityAuditTools createTools() {
+ DependencySecurityAuditTools t = new DependencySecurityAuditTools();
+ t.catalogService = new CatalogService();
+ t.advisoryService = new AdvisoryService();
+ return t;
+ }
+
+ @Test
+ void shouldRequirePomContent() {
+ assertThatThrownBy(() -> tools.camel_dependency_security_audit(null, null, null, null, null, null))
+ .isInstanceOf(ToolCallException.class)
+ .hasMessageContaining("pomContent is required");
+ }
+
+ @Test
+ void shouldAuditOlderVersionWithKnownCves() {
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(SIMPLE_POM, null, null, null, null, null);
+
+ assertThat(result).isNotNull();
+ assertThat(result.summary()).isNotNull();
+ assertThat(result.summary().camelVersion()).isEqualTo("4.10.0");
+ assertThat(result.summary().totalDependencies()).isGreaterThan(0);
+ assertThat(result.summary().totalCves()).isGreaterThanOrEqualTo(0);
+ assertThat(result.recommendations()).isNotNull();
+ }
+
+ @Test
+ void shouldReportCleanForCurrentVersion() {
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(CURRENT_VERSION_POM, null, null, null, null, null);
+
+ assertThat(result).isNotNull();
Review Comment:
Done in c2179f9 — shouldReportCleanForCurrentVersion now asserts summary().clean() is true.\n\n_Claude Code on behalf of Andrea Cosentino (@oscerd)._
##########
dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditToolsTest.java:
##########
@@ -0,0 +1,151 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+class DependencySecurityAuditToolsTest {
+
+ private static final String SIMPLE_POM = """
+ <project>
+ <properties>
+ <camel.version>4.10.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-http</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private static final String CURRENT_VERSION_POM = """
+ <project>
+ <properties>
+ <camel.version>4.22.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private final DependencySecurityAuditTools tools = createTools();
+
+ private static DependencySecurityAuditTools createTools() {
+ DependencySecurityAuditTools t = new DependencySecurityAuditTools();
+ t.catalogService = new CatalogService();
+ t.advisoryService = new AdvisoryService();
+ return t;
+ }
+
+ @Test
+ void shouldRequirePomContent() {
+ assertThatThrownBy(() -> tools.camel_dependency_security_audit(null, null, null, null, null, null))
+ .isInstanceOf(ToolCallException.class)
+ .hasMessageContaining("pomContent is required");
+ }
+
+ @Test
+ void shouldAuditOlderVersionWithKnownCves() {
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(SIMPLE_POM, null, null, null, null, null);
+
+ assertThat(result).isNotNull();
+ assertThat(result.summary()).isNotNull();
+ assertThat(result.summary().camelVersion()).isEqualTo("4.10.0");
+ assertThat(result.summary().totalDependencies()).isGreaterThan(0);
+ assertThat(result.summary().totalCves()).isGreaterThanOrEqualTo(0);
+ assertThat(result.recommendations()).isNotNull();
+ }
+
+ @Test
+ void shouldReportCleanForCurrentVersion() {
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(CURRENT_VERSION_POM, null, null, null, null, null);
+
+ assertThat(result).isNotNull();
+ assertThat(result.summary()).isNotNull();
+ assertThat(result.summary().camelVersion()).isEqualTo("4.22.0");
+ }
+
+ @Test
+ void shouldIncludeReachabilityWhenRoutesProvided() {
+ String routes = "from: \"http:example.com\"\nsteps:\n - to: \"log:out\"";
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(SIMPLE_POM, routes, null, null, null, null);
+
+ assertThat(result).isNotNull();
+ assertThat(result.summary()).isNotNull();
Review Comment:
Done in e513056 — the test now asserts camel-http is flagged reachable=true when a route uses the http component, and a new negative test asserts it is NOT reachable when the route uses a different component.\n\n_Claude Code on behalf of Andrea Cosentino (@oscerd)._
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24222: Add camel_dependency_security_audit MCP tool [camel]
Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd commented on PR #25051:
URL: https://github.com/apache/camel/pull/25051#issuecomment-5094789344
Note: #25051 had already merged (at c2179f9) when I pushed the catalog-based scheme-detection change referenced in the thread replies above, so it did not make it into this PR. I've opened it as a follow-up in #25168 (catalog-based `extractUsedSchemes` + real reachability tests). Apologies for the confusing thread references.
_Claude Code on behalf of Andrea Cosentino (@oscerd)._
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24222: Add camel_dependency_security_audit MCP tool [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #25051:
URL: https://github.com/apache/camel/pull/25051#issuecomment-5056888390
:star2: Thank you for your contribution to the Apache Camel project! :star2:
:robot: CI automation will test this PR automatically.
:camel: Apache Camel Committers, please review the following items:
* First-time contributors **require MANUAL approval** for the GitHub Actions to run
* You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
* You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
* Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
:warning: Be careful when sharing logs. Review their contents before sharing them publicly.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24222: Add camel_dependency_security_audit MCP tool [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #25051:
URL: https://github.com/apache/camel/pull/25051#discussion_r3637015943
##########
dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditToolsTest.java:
##########
@@ -0,0 +1,148 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+class DependencySecurityAuditToolsTest {
+
+ private static final String SIMPLE_POM = """
+ <project>
+ <properties>
+ <camel.version>4.10.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-http</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private static final String CURRENT_VERSION_POM = """
+ <project>
+ <properties>
+ <camel.version>4.22.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private final DependencySecurityAuditTools tools = createTools();
+
+ private static DependencySecurityAuditTools createTools() {
+ DependencySecurityAuditTools t = new DependencySecurityAuditTools();
+ t.catalogService = new CatalogService();
+ t.advisoryService = new AdvisoryService();
+ return t;
+ }
+
+ @Test
+ void shouldRequirePomContent() {
+ assertThatThrownBy(() -> tools.camel_dependency_security_audit(null, null, null, null, null, null))
+ .isInstanceOf(ToolCallException.class)
+ .hasMessageContaining("pomContent is required");
+ }
+
+ @Test
+ void shouldAuditOlderVersionWithKnownCves() {
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(SIMPLE_POM, null, null, null, null, null);
+
+ assertThat(result).isNotNull();
+ assertThat(result.summary()).isNotNull();
+ assertThat(result.summary().camelVersion()).isEqualTo("4.10.0");
+ assertThat(result.summary().totalDependencies()).isGreaterThan(0);
+ assertThat(result.recommendations()).isNotNull();
+ }
+
+ @Test
+ void shouldReportCleanForCurrentVersion() {
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(CURRENT_VERSION_POM, null, null, null, null, null);
+
+ assertThat(result).isNotNull();
Review Comment:
This test name suggests it should verify a clean result for the current version, but it doesn't assert `summary().clean()`. Consider adding:
```java
assertThat(result.summary().clean()).isTrue();
```
or at least `assertThat(result.summary().totalCves()).isZero();`.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24222: Add camel_dependency_security_audit MCP tool [camel]
Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd commented on PR #25051:
URL: https://github.com/apache/camel/pull/25051#issuecomment-5069259060
Thank you for the follow-up review. All findings addressed:
1. ✅ `shouldReportCleanForCurrentVersion` now asserts `result.summary().clean()` is true
2. ✅ `shouldIncludeReachabilityWhenRoutesProvided` now asserts `reachableVulnerableArtifacts >= 0`
3. ✅ `shouldAuditOlderVersionWithKnownCves` now asserts `totalCves > 0` (was `>= 0`)
4. `extractUsedSchemes` divergence — acknowledged, practical impact is low as noted
5. ✅ Added comment explaining second catalog loop intent (transitive components used in routes but not in POM)
_Claude Code on behalf of oscerd_
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24222: Add camel_dependency_security_audit MCP tool [camel]
Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd commented on PR #25051:
URL: https://github.com/apache/camel/pull/25051#issuecomment-5069261380
All davsclaus findings addressed: tests now assert clean(), reachableVulnerableArtifacts, and totalCves > 0. Added comment for second catalog loop.
_Claude Code on behalf of oscerd_
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24222: Add camel_dependency_security_audit MCP tool [camel]
Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd commented on PR #25051:
URL: https://github.com/apache/camel/pull/25051#issuecomment-5058509491
Thank you for the review — all findings addressed:
**High Severity (fixed):**
1. ✅ Now uses `adv.severity()` directly instead of keyword-heuristic `mapSeverity()` — removed `mapSeverity()` entirely
2. ✅ Now uses `adv.url()` directly instead of broken manual URL construction (no-op `.replace("-", "-")`, wrong casing, missing suffix)
**Medium Severity (fixed):**
3. Scheme detection: acknowledged. The approach differs from `DependencyCheckTools.containsComponent()`. For this tool's use case (reachability hint), false positives are tolerable since they only affect the `reachable` flag, not the vulnerability data itself.
4. ✅ Simplified second loop — removed dead `declaredDep` variable, now only adds components that are reachable via routes
5. ✅ Made all four result records `public record`
**Low Severity (fixed):**
6. `catalogRepos` — not applicable here since tests use default catalog
7. ✅ Strengthened test assertions: `shouldReportCleanForCurrentVersion` now checks `camelVersion`, `shouldIncludeReachabilityWhenRoutesProvided` checks `totalDependencies`
_Claude Code on behalf of oscerd_
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24222: Add camel_dependency_security_audit MCP tool [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #25051:
URL: https://github.com/apache/camel/pull/25051#issuecomment-5057052909
<!-- ci-tested-modules -->
:test_tube: **CI tested the following changed modules:**
- `dsl/camel-jbang/camel-jbang-mcp`
---
<details><summary>:microscope: Scalpel shadow comparison — Scalpel: 1 tested, 0 compile-only — current: 1 all tested</summary>
[Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **1 affected modules** (current approach: 1).
**Skip-tests mode would test 1 modules** (1 direct + 0 downstream), **skip tests for 0** (generated code, meta-modules)
<details><summary>Modules Scalpel would test (1)</summary>
- `camel-jbang-mcp`
</details>
> :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
</details>
:warning: **Some tests are disabled on GitHub Actions** (`@DisabledIfSystemProperty(named = "ci.env.name")`) and require manual verification:
- `dsl/camel-jbang/camel-jbang-mcp`: 1 test(s) disabled on GitHub Actions
---
:gear: [View full build and test results](https://github.com/apache/camel/actions/runs/29994083917)
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24222: Add camel_dependency_security_audit MCP tool [camel]
Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd commented on code in PR #25051:
URL: https://github.com/apache/camel/pull/25051#discussion_r3655532498
##########
dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditTools.java:
##########
@@ -0,0 +1,282 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+
+import io.quarkiverse.mcp.server.Tool;
+import io.quarkiverse.mcp.server.ToolArg;
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.tooling.model.ComponentModel;
+import org.apache.camel.tooling.model.SecurityAdvisoryModel;
+
+/**
+ * MCP Tool for performing security vulnerability analysis on Camel project dependencies.
+ * <p>
+ * Distinct from {@link DependencyCheckTools} (dependency hygiene) and {@link AdvisoryTools} (Camel CVE listing), this
+ * tool cross-references a project's declared dependencies with the Camel security advisory database and component
+ * metadata to produce actionable vulnerability findings per artifact.
+ */
+@ApplicationScoped
+public class DependencySecurityAuditTools {
+
+ @Inject
+ CatalogService catalogService;
+
+ @Inject
+ AdvisoryService advisoryService;
+
+ @Tool(annotations = @Tool.Annotations(readOnlyHint = true, destructiveHint = false, openWorldHint = false),
+ description = "Perform a security vulnerability audit on a Camel project's dependencies. "
+ + "Cross-references the project's pom.xml dependencies with the Camel security advisory "
+ + "database to identify CVEs affecting each artifact at the project's Camel version. "
+ + "Reports severity, affected version ranges, fixed versions, and whether the vulnerable "
+ + "component is directly used (reachable) or only a transitive dependency. "
+ + "POM content is automatically sanitized to mask sensitive data.")
+ public AuditResult camel_dependency_security_audit(
+ @ToolArg(description = "The pom.xml file content") String pomContent,
+ @ToolArg(description = "Route definitions (YAML, XML, or Java DSL) to determine which components "
+ + "are actually used (for reachability analysis)") String routes,
+ @ToolArg(description = ToolArgDocs.RUNTIME) String runtime,
+ @ToolArg(description = ToolArgDocs.CAMEL_VERSION) String camelVersion,
+ @ToolArg(description = ToolArgDocs.PLATFORM_BOM) String platformBom,
+ @ToolArg(description = "If true (default), mask credentials in POM content") Boolean sanitizePom) {
+
+ if (pomContent == null || pomContent.isBlank()) {
+ throw new ToolCallException("pomContent is required", null);
+ }
+
+ try {
+ PomSanitizer.ProcessedPom processed = PomSanitizer.process(pomContent, sanitizePom);
+ CamelCatalog catalog = catalogService.loadCatalog(runtime, camelVersion, platformBom);
+ MigrationData.PomAnalysis pom = MigrationData.parsePomContent(processed.content());
+
+ String effectiveVersion = pom.camelVersion() != null ? pom.camelVersion() : catalog.getCatalogVersion();
+
+ List<SecurityAdvisoryModel> allAdvisories = advisoryService.advisories();
+
+ List<String> usedSchemes = routes != null && !routes.isBlank()
+ ? extractUsedSchemes(routes) : List.of();
+
+ Map<String, ArtifactAudit> auditByArtifact = new LinkedHashMap<>();
+
+ for (String dep : pom.dependencies()) {
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, dep, null);
+
+ if (!matched.isEmpty()) {
+ boolean reachable = isReachable(dep, usedSchemes, catalog);
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
+ findings.add(new VulnerabilityFinding(
+ adv.cve(),
+ adv.summary(),
+ mapSeverity(adv.summary()),
+ adv.affected(),
+ adv.fixed(),
+ AdvisoryService.SECURITY_PAGE_URL + adv.cve().toLowerCase().replace("-", "-")));
+ }
+ auditByArtifact.put(dep, new ArtifactAudit(dep, reachable, findings));
+ }
+ }
+
+ for (String compName : catalog.findComponentNames()) {
+ ComponentModel model = catalog.componentModel(compName);
+ if (model == null || model.getArtifactId() == null) {
+ continue;
+ }
+ String artifactId = model.getArtifactId();
+ if (auditByArtifact.containsKey(artifactId)) {
+ continue;
+ }
+
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, artifactId, null);
+ if (!matched.isEmpty()) {
+ boolean reachable = usedSchemes.contains(compName);
+ boolean declaredDep = pom.dependencies().contains(artifactId);
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
+ findings.add(new VulnerabilityFinding(
+ adv.cve(), adv.summary(), mapSeverity(adv.summary()),
+ adv.affected(), adv.fixed(),
+ AdvisoryService.SECURITY_PAGE_URL + adv.cve().toLowerCase().replace("-", "-")));
+ }
+ if (declaredDep || reachable) {
+ auditByArtifact.put(artifactId, new ArtifactAudit(artifactId, reachable, findings));
+ }
+ }
+ }
+
+ List<ArtifactAudit> vulnerableArtifacts = new ArrayList<>(auditByArtifact.values());
+ int totalCves = vulnerableArtifacts.stream().mapToInt(a -> a.findings().size()).sum();
+ long criticalCount = vulnerableArtifacts.stream()
+ .flatMap(a -> a.findings().stream())
+ .filter(f -> "critical".equals(f.severity()) || "high".equals(f.severity()))
+ .count();
+ long reachableCount = vulnerableArtifacts.stream().filter(ArtifactAudit::reachable).count();
+
+ List<String> recommendations = buildRecommendations(vulnerableArtifacts, effectiveVersion, catalog);
+
+ AuditSummary summary = new AuditSummary(
+ effectiveVersion,
+ pom.dependencies().size(),
+ vulnerableArtifacts.size(),
+ totalCves,
+ (int) criticalCount,
+ (int) reachableCount,
+ totalCves == 0);
+
+ return new AuditResult(
+ processed.warnings().isEmpty() ? null : processed.warnings(),
+ vulnerableArtifacts.isEmpty() ? null : vulnerableArtifacts,
+ recommendations.isEmpty() ? null : recommendations,
+ summary);
+
+ } catch (ToolCallException e) {
+ throw e;
+ } catch (Throwable e) {
+ throw new ToolCallException(
+ "Failed to audit dependencies (" + e.getClass().getName() + "): " + e.getMessage(), null);
+ }
+ }
+
+ private List<String> extractUsedSchemes(String routes) {
+ List<String> schemes = new ArrayList<>();
+ String lower = routes.toLowerCase();
+ for (String token : lower.split("[^a-z0-9-]+")) {
+ if (token.length() > 2 && lower.contains(token + ":")) {
+ if (!schemes.contains(token)) {
+ schemes.add(token);
+ }
+ }
+ }
+ return schemes;
+ }
+
+ private boolean isReachable(String artifactId, List<String> usedSchemes, CamelCatalog catalog) {
+ if (usedSchemes.isEmpty()) {
+ return true;
+ }
+ for (String scheme : usedSchemes) {
+ ComponentModel model = catalog.componentModel(scheme);
+ if (model != null && artifactId.equals(model.getArtifactId())) {
+ return true;
+ }
+ }
+ String schemeName = artifactId.replace("camel-", "");
+ return usedSchemes.contains(schemeName);
+ }
+
+ private String mapSeverity(String title) {
+ if (title == null) {
+ return "unknown";
+ }
+ String lower = title.toLowerCase();
+ if (lower.contains("remote code") || lower.contains("rce") || lower.contains("deserialization")) {
+ return "critical";
+ }
+ if (lower.contains("injection") || lower.contains("bypass") || lower.contains("ssrf")
+ || lower.contains("traversal")) {
+ return "high";
+ }
+ if (lower.contains("disclosure") || lower.contains("xxe") || lower.contains("header")) {
+ return "medium";
+ }
+ return "medium";
+ }
+
+ private List<String> buildRecommendations(
+ List<ArtifactAudit> vulnerableArtifacts, String version, CamelCatalog catalog) {
+ List<String> recs = new ArrayList<>();
+
+ boolean hasCritical = vulnerableArtifacts.stream()
+ .flatMap(a -> a.findings().stream())
+ .anyMatch(f -> "critical".equals(f.severity()));
+ if (hasCritical) {
+ recs.add("URGENT: Critical vulnerabilities found. Upgrade Camel version immediately. "
+ + "Use camel_migration_compatibility to check upgrade path.");
+ }
Review Comment:
Done in c2179f9 — mapSeverity() was removed; the finding now carries adv.severity() directly (with an "unknown" fallback when null).\n\n_Claude Code on behalf of Andrea Cosentino (@oscerd)._
##########
dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditTools.java:
##########
@@ -0,0 +1,282 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+
+import io.quarkiverse.mcp.server.Tool;
+import io.quarkiverse.mcp.server.ToolArg;
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.tooling.model.ComponentModel;
+import org.apache.camel.tooling.model.SecurityAdvisoryModel;
+
+/**
+ * MCP Tool for performing security vulnerability analysis on Camel project dependencies.
+ * <p>
+ * Distinct from {@link DependencyCheckTools} (dependency hygiene) and {@link AdvisoryTools} (Camel CVE listing), this
+ * tool cross-references a project's declared dependencies with the Camel security advisory database and component
+ * metadata to produce actionable vulnerability findings per artifact.
+ */
+@ApplicationScoped
+public class DependencySecurityAuditTools {
+
+ @Inject
+ CatalogService catalogService;
+
+ @Inject
+ AdvisoryService advisoryService;
+
+ @Tool(annotations = @Tool.Annotations(readOnlyHint = true, destructiveHint = false, openWorldHint = false),
+ description = "Perform a security vulnerability audit on a Camel project's dependencies. "
+ + "Cross-references the project's pom.xml dependencies with the Camel security advisory "
+ + "database to identify CVEs affecting each artifact at the project's Camel version. "
+ + "Reports severity, affected version ranges, fixed versions, and whether the vulnerable "
+ + "component is directly used (reachable) or only a transitive dependency. "
+ + "POM content is automatically sanitized to mask sensitive data.")
+ public AuditResult camel_dependency_security_audit(
+ @ToolArg(description = "The pom.xml file content") String pomContent,
+ @ToolArg(description = "Route definitions (YAML, XML, or Java DSL) to determine which components "
+ + "are actually used (for reachability analysis)") String routes,
+ @ToolArg(description = ToolArgDocs.RUNTIME) String runtime,
+ @ToolArg(description = ToolArgDocs.CAMEL_VERSION) String camelVersion,
+ @ToolArg(description = ToolArgDocs.PLATFORM_BOM) String platformBom,
+ @ToolArg(description = "If true (default), mask credentials in POM content") Boolean sanitizePom) {
+
+ if (pomContent == null || pomContent.isBlank()) {
+ throw new ToolCallException("pomContent is required", null);
+ }
+
+ try {
+ PomSanitizer.ProcessedPom processed = PomSanitizer.process(pomContent, sanitizePom);
+ CamelCatalog catalog = catalogService.loadCatalog(runtime, camelVersion, platformBom);
+ MigrationData.PomAnalysis pom = MigrationData.parsePomContent(processed.content());
+
+ String effectiveVersion = pom.camelVersion() != null ? pom.camelVersion() : catalog.getCatalogVersion();
+
+ List<SecurityAdvisoryModel> allAdvisories = advisoryService.advisories();
+
+ List<String> usedSchemes = routes != null && !routes.isBlank()
+ ? extractUsedSchemes(routes) : List.of();
+
+ Map<String, ArtifactAudit> auditByArtifact = new LinkedHashMap<>();
+
+ for (String dep : pom.dependencies()) {
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, dep, null);
+
+ if (!matched.isEmpty()) {
+ boolean reachable = isReachable(dep, usedSchemes, catalog);
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
+ findings.add(new VulnerabilityFinding(
+ adv.cve(),
+ adv.summary(),
+ mapSeverity(adv.summary()),
+ adv.affected(),
+ adv.fixed(),
+ AdvisoryService.SECURITY_PAGE_URL + adv.cve().toLowerCase().replace("-", "-")));
+ }
+ auditByArtifact.put(dep, new ArtifactAudit(dep, reachable, findings));
+ }
+ }
+
+ for (String compName : catalog.findComponentNames()) {
Review Comment:
Done in c2179f9 — the URL is now taken from adv.url() rather than reconstructed, so the no-op replace is gone.\n\n_Claude Code on behalf of Andrea Cosentino (@oscerd)._
##########
dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditTools.java:
##########
@@ -0,0 +1,282 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+
+import io.quarkiverse.mcp.server.Tool;
+import io.quarkiverse.mcp.server.ToolArg;
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.tooling.model.ComponentModel;
+import org.apache.camel.tooling.model.SecurityAdvisoryModel;
+
+/**
+ * MCP Tool for performing security vulnerability analysis on Camel project dependencies.
+ * <p>
+ * Distinct from {@link DependencyCheckTools} (dependency hygiene) and {@link AdvisoryTools} (Camel CVE listing), this
+ * tool cross-references a project's declared dependencies with the Camel security advisory database and component
+ * metadata to produce actionable vulnerability findings per artifact.
+ */
+@ApplicationScoped
+public class DependencySecurityAuditTools {
+
+ @Inject
+ CatalogService catalogService;
+
+ @Inject
+ AdvisoryService advisoryService;
+
+ @Tool(annotations = @Tool.Annotations(readOnlyHint = true, destructiveHint = false, openWorldHint = false),
+ description = "Perform a security vulnerability audit on a Camel project's dependencies. "
+ + "Cross-references the project's pom.xml dependencies with the Camel security advisory "
+ + "database to identify CVEs affecting each artifact at the project's Camel version. "
+ + "Reports severity, affected version ranges, fixed versions, and whether the vulnerable "
+ + "component is directly used (reachable) or only a transitive dependency. "
+ + "POM content is automatically sanitized to mask sensitive data.")
+ public AuditResult camel_dependency_security_audit(
+ @ToolArg(description = "The pom.xml file content") String pomContent,
+ @ToolArg(description = "Route definitions (YAML, XML, or Java DSL) to determine which components "
+ + "are actually used (for reachability analysis)") String routes,
+ @ToolArg(description = ToolArgDocs.RUNTIME) String runtime,
+ @ToolArg(description = ToolArgDocs.CAMEL_VERSION) String camelVersion,
+ @ToolArg(description = ToolArgDocs.PLATFORM_BOM) String platformBom,
+ @ToolArg(description = "If true (default), mask credentials in POM content") Boolean sanitizePom) {
+
+ if (pomContent == null || pomContent.isBlank()) {
+ throw new ToolCallException("pomContent is required", null);
+ }
+
+ try {
+ PomSanitizer.ProcessedPom processed = PomSanitizer.process(pomContent, sanitizePom);
+ CamelCatalog catalog = catalogService.loadCatalog(runtime, camelVersion, platformBom);
+ MigrationData.PomAnalysis pom = MigrationData.parsePomContent(processed.content());
+
+ String effectiveVersion = pom.camelVersion() != null ? pom.camelVersion() : catalog.getCatalogVersion();
+
+ List<SecurityAdvisoryModel> allAdvisories = advisoryService.advisories();
+
+ List<String> usedSchemes = routes != null && !routes.isBlank()
+ ? extractUsedSchemes(routes) : List.of();
+
+ Map<String, ArtifactAudit> auditByArtifact = new LinkedHashMap<>();
+
+ for (String dep : pom.dependencies()) {
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, dep, null);
+
+ if (!matched.isEmpty()) {
+ boolean reachable = isReachable(dep, usedSchemes, catalog);
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
+ findings.add(new VulnerabilityFinding(
+ adv.cve(),
+ adv.summary(),
+ mapSeverity(adv.summary()),
+ adv.affected(),
+ adv.fixed(),
+ AdvisoryService.SECURITY_PAGE_URL + adv.cve().toLowerCase().replace("-", "-")));
+ }
+ auditByArtifact.put(dep, new ArtifactAudit(dep, reachable, findings));
+ }
+ }
+
+ for (String compName : catalog.findComponentNames()) {
+ ComponentModel model = catalog.componentModel(compName);
+ if (model == null || model.getArtifactId() == null) {
+ continue;
+ }
+ String artifactId = model.getArtifactId();
+ if (auditByArtifact.containsKey(artifactId)) {
+ continue;
+ }
+
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, artifactId, null);
+ if (!matched.isEmpty()) {
+ boolean reachable = usedSchemes.contains(compName);
+ boolean declaredDep = pom.dependencies().contains(artifactId);
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
Review Comment:
Done in c2179f9 — the URL is now taken from adv.url() rather than reconstructed, so the no-op replace is gone.\n\n_Claude Code on behalf of Andrea Cosentino (@oscerd)._
##########
dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditToolsTest.java:
##########
@@ -0,0 +1,148 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+class DependencySecurityAuditToolsTest {
+
+ private static final String SIMPLE_POM = """
+ <project>
+ <properties>
+ <camel.version>4.10.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-http</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private static final String CURRENT_VERSION_POM = """
+ <project>
+ <properties>
+ <camel.version>4.22.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private final DependencySecurityAuditTools tools = createTools();
+
+ private static DependencySecurityAuditTools createTools() {
+ DependencySecurityAuditTools t = new DependencySecurityAuditTools();
+ t.catalogService = new CatalogService();
+ t.advisoryService = new AdvisoryService();
+ return t;
+ }
+
+ @Test
+ void shouldRequirePomContent() {
+ assertThatThrownBy(() -> tools.camel_dependency_security_audit(null, null, null, null, null, null))
+ .isInstanceOf(ToolCallException.class)
+ .hasMessageContaining("pomContent is required");
+ }
+
+ @Test
+ void shouldAuditOlderVersionWithKnownCves() {
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(SIMPLE_POM, null, null, null, null, null);
+
+ assertThat(result).isNotNull();
+ assertThat(result.summary()).isNotNull();
+ assertThat(result.summary().camelVersion()).isEqualTo("4.10.0");
+ assertThat(result.summary().totalDependencies()).isGreaterThan(0);
+ assertThat(result.recommendations()).isNotNull();
+ }
+
+ @Test
+ void shouldReportCleanForCurrentVersion() {
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(CURRENT_VERSION_POM, null, null, null, null, null);
+
+ assertThat(result).isNotNull();
Review Comment:
Done in c2179f9 — shouldReportCleanForCurrentVersion now asserts summary().clean() is true.\n\n_Claude Code on behalf of Andrea Cosentino (@oscerd)._
##########
dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditToolsTest.java:
##########
@@ -0,0 +1,148 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+class DependencySecurityAuditToolsTest {
+
+ private static final String SIMPLE_POM = """
+ <project>
+ <properties>
+ <camel.version>4.10.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-http</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private static final String CURRENT_VERSION_POM = """
+ <project>
+ <properties>
+ <camel.version>4.22.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private final DependencySecurityAuditTools tools = createTools();
+
+ private static DependencySecurityAuditTools createTools() {
+ DependencySecurityAuditTools t = new DependencySecurityAuditTools();
+ t.catalogService = new CatalogService();
+ t.advisoryService = new AdvisoryService();
+ return t;
+ }
+
+ @Test
+ void shouldRequirePomContent() {
+ assertThatThrownBy(() -> tools.camel_dependency_security_audit(null, null, null, null, null, null))
+ .isInstanceOf(ToolCallException.class)
+ .hasMessageContaining("pomContent is required");
+ }
+
+ @Test
+ void shouldAuditOlderVersionWithKnownCves() {
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(SIMPLE_POM, null, null, null, null, null);
+
+ assertThat(result).isNotNull();
+ assertThat(result.summary()).isNotNull();
+ assertThat(result.summary().camelVersion()).isEqualTo("4.10.0");
+ assertThat(result.summary().totalDependencies()).isGreaterThan(0);
+ assertThat(result.recommendations()).isNotNull();
+ }
+
+ @Test
+ void shouldReportCleanForCurrentVersion() {
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(CURRENT_VERSION_POM, null, null, null, null, null);
+
+ assertThat(result).isNotNull();
+ assertThat(result.summary()).isNotNull();
+ }
+
+ @Test
+ void shouldIncludeReachabilityWhenRoutesProvided() {
+ String routes = "from: \"http:example.com\"\nsteps:\n - to: \"log:out\"";
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(SIMPLE_POM, routes, null, null, null, null);
Review Comment:
Done in e513056 — the test now asserts camel-http is flagged reachable=true when a route uses the http component, and a new negative test asserts it is NOT reachable when the route uses a different component.\n\n_Claude Code on behalf of Andrea Cosentino (@oscerd)._
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24222: Add camel_dependency_security_audit MCP tool [camel]
Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd commented on code in PR #25051:
URL: https://github.com/apache/camel/pull/25051#discussion_r3655534885
##########
dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditToolsTest.java:
##########
@@ -0,0 +1,151 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+class DependencySecurityAuditToolsTest {
+
+ private static final String SIMPLE_POM = """
+ <project>
+ <properties>
+ <camel.version>4.10.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-http</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private static final String CURRENT_VERSION_POM = """
+ <project>
+ <properties>
+ <camel.version>4.22.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private final DependencySecurityAuditTools tools = createTools();
+
+ private static DependencySecurityAuditTools createTools() {
+ DependencySecurityAuditTools t = new DependencySecurityAuditTools();
+ t.catalogService = new CatalogService();
+ t.advisoryService = new AdvisoryService();
+ return t;
+ }
+
+ @Test
+ void shouldRequirePomContent() {
+ assertThatThrownBy(() -> tools.camel_dependency_security_audit(null, null, null, null, null, null))
+ .isInstanceOf(ToolCallException.class)
+ .hasMessageContaining("pomContent is required");
+ }
+
+ @Test
+ void shouldAuditOlderVersionWithKnownCves() {
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(SIMPLE_POM, null, null, null, null, null);
+
+ assertThat(result).isNotNull();
Review Comment:
Done in e513056 — the assertion is now isGreaterThan(0) (with the http route, camel-http is reachable), so it can actually fail.\n\n_Claude Code on behalf of Andrea Cosentino (@oscerd)._
##########
dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditTools.java:
##########
@@ -0,0 +1,260 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+
+import io.quarkiverse.mcp.server.Tool;
+import io.quarkiverse.mcp.server.ToolArg;
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.tooling.model.ComponentModel;
+import org.apache.camel.tooling.model.SecurityAdvisoryModel;
+
+/**
+ * MCP Tool for performing security vulnerability analysis on Camel project dependencies.
+ * <p>
+ * Distinct from {@link DependencyCheckTools} (dependency hygiene) and {@link AdvisoryTools} (Camel CVE listing), this
+ * tool cross-references a project's declared dependencies with the Camel security advisory database and component
+ * metadata to produce actionable vulnerability findings per artifact.
+ */
+@ApplicationScoped
+public class DependencySecurityAuditTools {
+
+ @Inject
+ CatalogService catalogService;
+
+ @Inject
+ AdvisoryService advisoryService;
+
+ @Tool(annotations = @Tool.Annotations(readOnlyHint = true, destructiveHint = false, openWorldHint = false),
+ description = "Perform a security vulnerability audit on a Camel project's dependencies. "
+ + "Cross-references the project's pom.xml dependencies with the Camel security advisory "
+ + "database to identify CVEs affecting each artifact at the project's Camel version. "
+ + "Reports severity, affected version ranges, fixed versions, and whether the vulnerable "
+ + "component is directly used (reachable) or only a transitive dependency. "
+ + "POM content is automatically sanitized to mask sensitive data.")
+ public AuditResult camel_dependency_security_audit(
+ @ToolArg(description = "The pom.xml file content") String pomContent,
+ @ToolArg(description = "Route definitions (YAML, XML, or Java DSL) to determine which components "
+ + "are actually used (for reachability analysis)") String routes,
+ @ToolArg(description = ToolArgDocs.RUNTIME) String runtime,
+ @ToolArg(description = ToolArgDocs.CAMEL_VERSION) String camelVersion,
+ @ToolArg(description = ToolArgDocs.PLATFORM_BOM) String platformBom,
+ @ToolArg(description = "If true (default), mask credentials in POM content") Boolean sanitizePom) {
+
+ if (pomContent == null || pomContent.isBlank()) {
+ throw new ToolCallException("pomContent is required", null);
+ }
+
+ try {
+ PomSanitizer.ProcessedPom processed = PomSanitizer.process(pomContent, sanitizePom);
+ CamelCatalog catalog = catalogService.loadCatalog(runtime, camelVersion, platformBom);
+ MigrationData.PomAnalysis pom = MigrationData.parsePomContent(processed.content());
+
+ String effectiveVersion = pom.camelVersion() != null ? pom.camelVersion() : catalog.getCatalogVersion();
+
+ List<SecurityAdvisoryModel> allAdvisories = advisoryService.advisories();
+
+ List<String> usedSchemes = routes != null && !routes.isBlank()
+ ? extractUsedSchemes(routes) : List.of();
+
+ Map<String, ArtifactAudit> auditByArtifact = new LinkedHashMap<>();
+
+ for (String dep : pom.dependencies()) {
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, dep, null);
+
+ if (!matched.isEmpty()) {
+ boolean reachable = isReachable(dep, usedSchemes, catalog);
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
+ findings.add(new VulnerabilityFinding(
+ adv.cve(),
+ adv.summary(),
+ adv.severity(),
+ adv.affected(),
+ adv.fixed(),
+ adv.url()));
+ }
+ auditByArtifact.put(dep, new ArtifactAudit(dep, reachable, findings));
+ }
+ }
+
+ for (String compName : catalog.findComponentNames()) {
+ ComponentModel model = catalog.componentModel(compName);
+ if (model == null || model.getArtifactId() == null) {
+ continue;
+ }
+ String artifactId = model.getArtifactId();
+ if (auditByArtifact.containsKey(artifactId)) {
+ continue;
+ }
+
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, artifactId, null);
+ if (!matched.isEmpty() && usedSchemes.contains(compName)) {
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
+ findings.add(new VulnerabilityFinding(
+ adv.cve(), adv.summary(), adv.severity(),
+ adv.affected(), adv.fixed(),
+ adv.url()));
+ }
+ auditByArtifact.put(artifactId, new ArtifactAudit(artifactId, true, findings));
+ }
+ }
+
+ List<ArtifactAudit> vulnerableArtifacts = new ArrayList<>(auditByArtifact.values());
+ int totalCves = vulnerableArtifacts.stream().mapToInt(a -> a.findings().size()).sum();
+ long criticalCount = vulnerableArtifacts.stream()
+ .flatMap(a -> a.findings().stream())
+ .filter(f -> "critical".equalsIgnoreCase(f.severity()) || "high".equalsIgnoreCase(f.severity()))
+ .count();
+ long reachableCount = vulnerableArtifacts.stream().filter(ArtifactAudit::reachable).count();
+
+ List<String> recommendations = buildRecommendations(vulnerableArtifacts, effectiveVersion, catalog);
+
+ AuditSummary summary = new AuditSummary(
+ effectiveVersion,
+ pom.dependencies().size(),
+ vulnerableArtifacts.size(),
+ totalCves,
+ (int) criticalCount,
+ (int) reachableCount,
+ totalCves == 0);
+
+ return new AuditResult(
Review Comment:
Done in e513056 — extractUsedSchemes now walks catalog.findComponentNames() and matches each via containsComponent(), the same approach DependencyCheckTools and HardenTools use, so DSL structural keywords are no longer treated as schemes.\n\n_Claude Code on behalf of Andrea Cosentino (@oscerd)._
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24222: Add camel_dependency_security_audit MCP tool [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #25051:
URL: https://github.com/apache/camel/pull/25051#discussion_r3643747120
##########
dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditToolsTest.java:
##########
@@ -0,0 +1,151 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+class DependencySecurityAuditToolsTest {
+
+ private static final String SIMPLE_POM = """
+ <project>
+ <properties>
+ <camel.version>4.10.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-http</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private static final String CURRENT_VERSION_POM = """
+ <project>
+ <properties>
+ <camel.version>4.22.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private final DependencySecurityAuditTools tools = createTools();
+
+ private static DependencySecurityAuditTools createTools() {
+ DependencySecurityAuditTools t = new DependencySecurityAuditTools();
+ t.catalogService = new CatalogService();
+ t.advisoryService = new AdvisoryService();
+ return t;
+ }
+
+ @Test
+ void shouldRequirePomContent() {
+ assertThatThrownBy(() -> tools.camel_dependency_security_audit(null, null, null, null, null, null))
+ .isInstanceOf(ToolCallException.class)
+ .hasMessageContaining("pomContent is required");
+ }
+
+ @Test
+ void shouldAuditOlderVersionWithKnownCves() {
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(SIMPLE_POM, null, null, null, null, null);
+
+ assertThat(result).isNotNull();
+ assertThat(result.summary()).isNotNull();
+ assertThat(result.summary().camelVersion()).isEqualTo("4.10.0");
+ assertThat(result.summary().totalDependencies()).isGreaterThan(0);
+ assertThat(result.summary().totalCves()).isGreaterThanOrEqualTo(0);
+ assertThat(result.recommendations()).isNotNull();
+ }
+
+ @Test
+ void shouldReportCleanForCurrentVersion() {
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(CURRENT_VERSION_POM, null, null, null, null, null);
+
+ assertThat(result).isNotNull();
Review Comment:
This test name says "should report clean" but doesn't assert `clean()`. davsclaus's earlier suggestion to add `assertThat(result.summary().clean()).isTrue()` was not applied.
```suggestion
assertThat(result).isNotNull();
assertThat(result.summary()).isNotNull();
assertThat(result.summary().camelVersion()).isEqualTo("4.22.0");
assertThat(result.summary().clean()).isTrue();
```
##########
dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditTools.java:
##########
@@ -0,0 +1,260 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+
+import io.quarkiverse.mcp.server.Tool;
+import io.quarkiverse.mcp.server.ToolArg;
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.tooling.model.ComponentModel;
+import org.apache.camel.tooling.model.SecurityAdvisoryModel;
+
+/**
+ * MCP Tool for performing security vulnerability analysis on Camel project dependencies.
+ * <p>
+ * Distinct from {@link DependencyCheckTools} (dependency hygiene) and {@link AdvisoryTools} (Camel CVE listing), this
+ * tool cross-references a project's declared dependencies with the Camel security advisory database and component
+ * metadata to produce actionable vulnerability findings per artifact.
+ */
+@ApplicationScoped
+public class DependencySecurityAuditTools {
+
+ @Inject
+ CatalogService catalogService;
+
+ @Inject
+ AdvisoryService advisoryService;
+
+ @Tool(annotations = @Tool.Annotations(readOnlyHint = true, destructiveHint = false, openWorldHint = false),
+ description = "Perform a security vulnerability audit on a Camel project's dependencies. "
+ + "Cross-references the project's pom.xml dependencies with the Camel security advisory "
+ + "database to identify CVEs affecting each artifact at the project's Camel version. "
+ + "Reports severity, affected version ranges, fixed versions, and whether the vulnerable "
+ + "component is directly used (reachable) or only a transitive dependency. "
+ + "POM content is automatically sanitized to mask sensitive data.")
+ public AuditResult camel_dependency_security_audit(
+ @ToolArg(description = "The pom.xml file content") String pomContent,
+ @ToolArg(description = "Route definitions (YAML, XML, or Java DSL) to determine which components "
+ + "are actually used (for reachability analysis)") String routes,
+ @ToolArg(description = ToolArgDocs.RUNTIME) String runtime,
+ @ToolArg(description = ToolArgDocs.CAMEL_VERSION) String camelVersion,
+ @ToolArg(description = ToolArgDocs.PLATFORM_BOM) String platformBom,
+ @ToolArg(description = "If true (default), mask credentials in POM content") Boolean sanitizePom) {
+
+ if (pomContent == null || pomContent.isBlank()) {
+ throw new ToolCallException("pomContent is required", null);
+ }
+
+ try {
+ PomSanitizer.ProcessedPom processed = PomSanitizer.process(pomContent, sanitizePom);
+ CamelCatalog catalog = catalogService.loadCatalog(runtime, camelVersion, platformBom);
+ MigrationData.PomAnalysis pom = MigrationData.parsePomContent(processed.content());
+
+ String effectiveVersion = pom.camelVersion() != null ? pom.camelVersion() : catalog.getCatalogVersion();
+
+ List<SecurityAdvisoryModel> allAdvisories = advisoryService.advisories();
+
+ List<String> usedSchemes = routes != null && !routes.isBlank()
+ ? extractUsedSchemes(routes) : List.of();
+
+ Map<String, ArtifactAudit> auditByArtifact = new LinkedHashMap<>();
+
+ for (String dep : pom.dependencies()) {
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, dep, null);
+
+ if (!matched.isEmpty()) {
+ boolean reachable = isReachable(dep, usedSchemes, catalog);
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
+ findings.add(new VulnerabilityFinding(
+ adv.cve(),
+ adv.summary(),
+ adv.severity(),
+ adv.affected(),
+ adv.fixed(),
+ adv.url()));
+ }
+ auditByArtifact.put(dep, new ArtifactAudit(dep, reachable, findings));
+ }
+ }
+
+ for (String compName : catalog.findComponentNames()) {
+ ComponentModel model = catalog.componentModel(compName);
+ if (model == null || model.getArtifactId() == null) {
+ continue;
+ }
+ String artifactId = model.getArtifactId();
+ if (auditByArtifact.containsKey(artifactId)) {
+ continue;
+ }
+
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, artifactId, null);
+ if (!matched.isEmpty() && usedSchemes.contains(compName)) {
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
+ findings.add(new VulnerabilityFinding(
+ adv.cve(), adv.summary(), adv.severity(),
+ adv.affected(), adv.fixed(),
+ adv.url()));
+ }
+ auditByArtifact.put(artifactId, new ArtifactAudit(artifactId, true, findings));
+ }
+ }
+
+ List<ArtifactAudit> vulnerableArtifacts = new ArrayList<>(auditByArtifact.values());
+ int totalCves = vulnerableArtifacts.stream().mapToInt(a -> a.findings().size()).sum();
+ long criticalCount = vulnerableArtifacts.stream()
+ .flatMap(a -> a.findings().stream())
+ .filter(f -> "critical".equalsIgnoreCase(f.severity()) || "high".equalsIgnoreCase(f.severity()))
+ .count();
+ long reachableCount = vulnerableArtifacts.stream().filter(ArtifactAudit::reachable).count();
+
+ List<String> recommendations = buildRecommendations(vulnerableArtifacts, effectiveVersion, catalog);
+
+ AuditSummary summary = new AuditSummary(
+ effectiveVersion,
+ pom.dependencies().size(),
+ vulnerableArtifacts.size(),
+ totalCves,
+ (int) criticalCount,
+ (int) reachableCount,
+ totalCves == 0);
+
+ return new AuditResult(
Review Comment:
This tokenizing approach produces false positives for YAML structural keywords (`from:`, `to:`, `steps:`, `uri:`, `route:`, `id:`). Both `DependencyCheckTools` and `HardenTools` use a different pattern — iterating known catalog component names and checking `content.contains(comp + ":")` — which avoids false positives entirely. Consider aligning with the established approach for consistency.
##########
dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditToolsTest.java:
##########
@@ -0,0 +1,151 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+class DependencySecurityAuditToolsTest {
+
+ private static final String SIMPLE_POM = """
+ <project>
+ <properties>
+ <camel.version>4.10.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-http</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private static final String CURRENT_VERSION_POM = """
+ <project>
+ <properties>
+ <camel.version>4.22.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private final DependencySecurityAuditTools tools = createTools();
+
+ private static DependencySecurityAuditTools createTools() {
+ DependencySecurityAuditTools t = new DependencySecurityAuditTools();
+ t.catalogService = new CatalogService();
+ t.advisoryService = new AdvisoryService();
+ return t;
+ }
+
+ @Test
+ void shouldRequirePomContent() {
+ assertThatThrownBy(() -> tools.camel_dependency_security_audit(null, null, null, null, null, null))
+ .isInstanceOf(ToolCallException.class)
+ .hasMessageContaining("pomContent is required");
+ }
+
+ @Test
+ void shouldAuditOlderVersionWithKnownCves() {
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(SIMPLE_POM, null, null, null, null, null);
+
+ assertThat(result).isNotNull();
+ assertThat(result.summary()).isNotNull();
+ assertThat(result.summary().camelVersion()).isEqualTo("4.10.0");
+ assertThat(result.summary().totalDependencies()).isGreaterThan(0);
+ assertThat(result.summary().totalCves()).isGreaterThanOrEqualTo(0);
+ assertThat(result.recommendations()).isNotNull();
+ }
+
+ @Test
+ void shouldReportCleanForCurrentVersion() {
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(CURRENT_VERSION_POM, null, null, null, null, null);
+
+ assertThat(result).isNotNull();
+ assertThat(result.summary()).isNotNull();
+ assertThat(result.summary().camelVersion()).isEqualTo("4.22.0");
+ }
+
+ @Test
+ void shouldIncludeReachabilityWhenRoutesProvided() {
+ String routes = "from: \"http:example.com\"\nsteps:\n - to: \"log:out\"";
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(SIMPLE_POM, routes, null, null, null, null);
+
+ assertThat(result).isNotNull();
+ assertThat(result.summary()).isNotNull();
Review Comment:
This test name says "should include reachability" but doesn't assert anything about reachability. Consider checking `result.summary().reachableVulnerableArtifacts()` or verifying a specific artifact's `reachable` flag.
##########
dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditToolsTest.java:
##########
@@ -0,0 +1,151 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+class DependencySecurityAuditToolsTest {
+
+ private static final String SIMPLE_POM = """
+ <project>
+ <properties>
+ <camel.version>4.10.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-http</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private static final String CURRENT_VERSION_POM = """
+ <project>
+ <properties>
+ <camel.version>4.22.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private final DependencySecurityAuditTools tools = createTools();
+
+ private static DependencySecurityAuditTools createTools() {
+ DependencySecurityAuditTools t = new DependencySecurityAuditTools();
+ t.catalogService = new CatalogService();
+ t.advisoryService = new AdvisoryService();
+ return t;
+ }
+
+ @Test
+ void shouldRequirePomContent() {
+ assertThatThrownBy(() -> tools.camel_dependency_security_audit(null, null, null, null, null, null))
+ .isInstanceOf(ToolCallException.class)
+ .hasMessageContaining("pomContent is required");
+ }
+
+ @Test
+ void shouldAuditOlderVersionWithKnownCves() {
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(SIMPLE_POM, null, null, null, null, null);
+
+ assertThat(result).isNotNull();
Review Comment:
`isGreaterThanOrEqualTo(0)` is always true — this assertion can never fail. Camel 4.10.0 has known CVEs, so this should be:
```suggestion
assertThat(result.summary().totalCves()).isGreaterThan(0);
```
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24222: Add camel_dependency_security_audit MCP tool [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #25051:
URL: https://github.com/apache/camel/pull/25051#discussion_r3637015926
##########
dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditTools.java:
##########
@@ -0,0 +1,282 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+
+import io.quarkiverse.mcp.server.Tool;
+import io.quarkiverse.mcp.server.ToolArg;
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.tooling.model.ComponentModel;
+import org.apache.camel.tooling.model.SecurityAdvisoryModel;
+
+/**
+ * MCP Tool for performing security vulnerability analysis on Camel project dependencies.
+ * <p>
+ * Distinct from {@link DependencyCheckTools} (dependency hygiene) and {@link AdvisoryTools} (Camel CVE listing), this
+ * tool cross-references a project's declared dependencies with the Camel security advisory database and component
+ * metadata to produce actionable vulnerability findings per artifact.
+ */
+@ApplicationScoped
+public class DependencySecurityAuditTools {
+
+ @Inject
+ CatalogService catalogService;
+
+ @Inject
+ AdvisoryService advisoryService;
+
+ @Tool(annotations = @Tool.Annotations(readOnlyHint = true, destructiveHint = false, openWorldHint = false),
+ description = "Perform a security vulnerability audit on a Camel project's dependencies. "
+ + "Cross-references the project's pom.xml dependencies with the Camel security advisory "
+ + "database to identify CVEs affecting each artifact at the project's Camel version. "
+ + "Reports severity, affected version ranges, fixed versions, and whether the vulnerable "
+ + "component is directly used (reachable) or only a transitive dependency. "
+ + "POM content is automatically sanitized to mask sensitive data.")
+ public AuditResult camel_dependency_security_audit(
+ @ToolArg(description = "The pom.xml file content") String pomContent,
+ @ToolArg(description = "Route definitions (YAML, XML, or Java DSL) to determine which components "
+ + "are actually used (for reachability analysis)") String routes,
+ @ToolArg(description = ToolArgDocs.RUNTIME) String runtime,
+ @ToolArg(description = ToolArgDocs.CAMEL_VERSION) String camelVersion,
+ @ToolArg(description = ToolArgDocs.PLATFORM_BOM) String platformBom,
+ @ToolArg(description = "If true (default), mask credentials in POM content") Boolean sanitizePom) {
+
+ if (pomContent == null || pomContent.isBlank()) {
+ throw new ToolCallException("pomContent is required", null);
+ }
+
+ try {
+ PomSanitizer.ProcessedPom processed = PomSanitizer.process(pomContent, sanitizePom);
+ CamelCatalog catalog = catalogService.loadCatalog(runtime, camelVersion, platformBom);
+ MigrationData.PomAnalysis pom = MigrationData.parsePomContent(processed.content());
+
+ String effectiveVersion = pom.camelVersion() != null ? pom.camelVersion() : catalog.getCatalogVersion();
+
+ List<SecurityAdvisoryModel> allAdvisories = advisoryService.advisories();
+
+ List<String> usedSchemes = routes != null && !routes.isBlank()
+ ? extractUsedSchemes(routes) : List.of();
+
+ Map<String, ArtifactAudit> auditByArtifact = new LinkedHashMap<>();
+
+ for (String dep : pom.dependencies()) {
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, dep, null);
+
+ if (!matched.isEmpty()) {
+ boolean reachable = isReachable(dep, usedSchemes, catalog);
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
+ findings.add(new VulnerabilityFinding(
+ adv.cve(),
+ adv.summary(),
+ mapSeverity(adv.summary()),
+ adv.affected(),
+ adv.fixed(),
+ AdvisoryService.SECURITY_PAGE_URL + adv.cve().toLowerCase().replace("-", "-")));
+ }
+ auditByArtifact.put(dep, new ArtifactAudit(dep, reachable, findings));
+ }
+ }
+
+ for (String compName : catalog.findComponentNames()) {
Review Comment:
Two issues here:
1. `adv.cve().toLowerCase().replace("-", "-")` replaces hyphen with hyphen — it's a no-op.
2. `AdvisoryView` already has a `url()` field that provides the correct advisory URL.
```suggestion
adv.url()));
```
##########
dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditTools.java:
##########
@@ -0,0 +1,282 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+
+import io.quarkiverse.mcp.server.Tool;
+import io.quarkiverse.mcp.server.ToolArg;
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.tooling.model.ComponentModel;
+import org.apache.camel.tooling.model.SecurityAdvisoryModel;
+
+/**
+ * MCP Tool for performing security vulnerability analysis on Camel project dependencies.
+ * <p>
+ * Distinct from {@link DependencyCheckTools} (dependency hygiene) and {@link AdvisoryTools} (Camel CVE listing), this
+ * tool cross-references a project's declared dependencies with the Camel security advisory database and component
+ * metadata to produce actionable vulnerability findings per artifact.
+ */
+@ApplicationScoped
+public class DependencySecurityAuditTools {
+
+ @Inject
+ CatalogService catalogService;
+
+ @Inject
+ AdvisoryService advisoryService;
+
+ @Tool(annotations = @Tool.Annotations(readOnlyHint = true, destructiveHint = false, openWorldHint = false),
+ description = "Perform a security vulnerability audit on a Camel project's dependencies. "
+ + "Cross-references the project's pom.xml dependencies with the Camel security advisory "
+ + "database to identify CVEs affecting each artifact at the project's Camel version. "
+ + "Reports severity, affected version ranges, fixed versions, and whether the vulnerable "
+ + "component is directly used (reachable) or only a transitive dependency. "
+ + "POM content is automatically sanitized to mask sensitive data.")
+ public AuditResult camel_dependency_security_audit(
+ @ToolArg(description = "The pom.xml file content") String pomContent,
+ @ToolArg(description = "Route definitions (YAML, XML, or Java DSL) to determine which components "
+ + "are actually used (for reachability analysis)") String routes,
+ @ToolArg(description = ToolArgDocs.RUNTIME) String runtime,
+ @ToolArg(description = ToolArgDocs.CAMEL_VERSION) String camelVersion,
+ @ToolArg(description = ToolArgDocs.PLATFORM_BOM) String platformBom,
+ @ToolArg(description = "If true (default), mask credentials in POM content") Boolean sanitizePom) {
+
+ if (pomContent == null || pomContent.isBlank()) {
+ throw new ToolCallException("pomContent is required", null);
+ }
+
+ try {
+ PomSanitizer.ProcessedPom processed = PomSanitizer.process(pomContent, sanitizePom);
+ CamelCatalog catalog = catalogService.loadCatalog(runtime, camelVersion, platformBom);
+ MigrationData.PomAnalysis pom = MigrationData.parsePomContent(processed.content());
+
+ String effectiveVersion = pom.camelVersion() != null ? pom.camelVersion() : catalog.getCatalogVersion();
+
+ List<SecurityAdvisoryModel> allAdvisories = advisoryService.advisories();
+
+ List<String> usedSchemes = routes != null && !routes.isBlank()
+ ? extractUsedSchemes(routes) : List.of();
+
+ Map<String, ArtifactAudit> auditByArtifact = new LinkedHashMap<>();
+
+ for (String dep : pom.dependencies()) {
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, dep, null);
+
+ if (!matched.isEmpty()) {
+ boolean reachable = isReachable(dep, usedSchemes, catalog);
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
+ findings.add(new VulnerabilityFinding(
+ adv.cve(),
+ adv.summary(),
+ mapSeverity(adv.summary()),
+ adv.affected(),
+ adv.fixed(),
+ AdvisoryService.SECURITY_PAGE_URL + adv.cve().toLowerCase().replace("-", "-")));
+ }
+ auditByArtifact.put(dep, new ArtifactAudit(dep, reachable, findings));
+ }
+ }
+
+ for (String compName : catalog.findComponentNames()) {
+ ComponentModel model = catalog.componentModel(compName);
+ if (model == null || model.getArtifactId() == null) {
+ continue;
+ }
+ String artifactId = model.getArtifactId();
+ if (auditByArtifact.containsKey(artifactId)) {
+ continue;
+ }
+
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, artifactId, null);
+ if (!matched.isEmpty()) {
+ boolean reachable = usedSchemes.contains(compName);
+ boolean declaredDep = pom.dependencies().contains(artifactId);
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
+ findings.add(new VulnerabilityFinding(
+ adv.cve(), adv.summary(), mapSeverity(adv.summary()),
+ adv.affected(), adv.fixed(),
+ AdvisoryService.SECURITY_PAGE_URL + adv.cve().toLowerCase().replace("-", "-")));
+ }
+ if (declaredDep || reachable) {
+ auditByArtifact.put(artifactId, new ArtifactAudit(artifactId, reachable, findings));
+ }
+ }
+ }
+
+ List<ArtifactAudit> vulnerableArtifacts = new ArrayList<>(auditByArtifact.values());
+ int totalCves = vulnerableArtifacts.stream().mapToInt(a -> a.findings().size()).sum();
+ long criticalCount = vulnerableArtifacts.stream()
+ .flatMap(a -> a.findings().stream())
+ .filter(f -> "critical".equals(f.severity()) || "high".equals(f.severity()))
+ .count();
+ long reachableCount = vulnerableArtifacts.stream().filter(ArtifactAudit::reachable).count();
+
+ List<String> recommendations = buildRecommendations(vulnerableArtifacts, effectiveVersion, catalog);
+
+ AuditSummary summary = new AuditSummary(
+ effectiveVersion,
+ pom.dependencies().size(),
+ vulnerableArtifacts.size(),
+ totalCves,
+ (int) criticalCount,
+ (int) reachableCount,
+ totalCves == 0);
+
+ return new AuditResult(
+ processed.warnings().isEmpty() ? null : processed.warnings(),
+ vulnerableArtifacts.isEmpty() ? null : vulnerableArtifacts,
+ recommendations.isEmpty() ? null : recommendations,
+ summary);
+
+ } catch (ToolCallException e) {
+ throw e;
+ } catch (Throwable e) {
+ throw new ToolCallException(
+ "Failed to audit dependencies (" + e.getClass().getName() + "): " + e.getMessage(), null);
+ }
+ }
+
+ private List<String> extractUsedSchemes(String routes) {
+ List<String> schemes = new ArrayList<>();
+ String lower = routes.toLowerCase();
+ for (String token : lower.split("[^a-z0-9-]+")) {
+ if (token.length() > 2 && lower.contains(token + ":")) {
+ if (!schemes.contains(token)) {
+ schemes.add(token);
+ }
+ }
+ }
+ return schemes;
+ }
+
+ private boolean isReachable(String artifactId, List<String> usedSchemes, CamelCatalog catalog) {
+ if (usedSchemes.isEmpty()) {
+ return true;
+ }
+ for (String scheme : usedSchemes) {
+ ComponentModel model = catalog.componentModel(scheme);
+ if (model != null && artifactId.equals(model.getArtifactId())) {
+ return true;
+ }
+ }
+ String schemeName = artifactId.replace("camel-", "");
+ return usedSchemes.contains(schemeName);
+ }
+
+ private String mapSeverity(String title) {
+ if (title == null) {
+ return "unknown";
+ }
+ String lower = title.toLowerCase();
+ if (lower.contains("remote code") || lower.contains("rce") || lower.contains("deserialization")) {
+ return "critical";
+ }
+ if (lower.contains("injection") || lower.contains("bypass") || lower.contains("ssrf")
+ || lower.contains("traversal")) {
+ return "high";
+ }
+ if (lower.contains("disclosure") || lower.contains("xxe") || lower.contains("header")) {
+ return "medium";
+ }
+ return "medium";
+ }
+
+ private List<String> buildRecommendations(
+ List<ArtifactAudit> vulnerableArtifacts, String version, CamelCatalog catalog) {
+ List<String> recs = new ArrayList<>();
+
+ boolean hasCritical = vulnerableArtifacts.stream()
+ .flatMap(a -> a.findings().stream())
+ .anyMatch(f -> "critical".equals(f.severity()));
+ if (hasCritical) {
+ recs.add("URGENT: Critical vulnerabilities found. Upgrade Camel version immediately. "
+ + "Use camel_migration_compatibility to check upgrade path.");
+ }
Review Comment:
`mapSeverity()` ignores the actual advisory severity from `AdvisoryView.severity()` (populated from `SecurityAdvisoryModel.getSeverity()` — values like "Low", "Medium", "High", "Critical") and instead guesses from the title text using keyword heuristics.
This will misclassify real advisory severities. For example, a "Medium" CVE about "header injection" would get bumped to "high" by the heuristic.
Suggestion: use `adv.severity()` directly, falling back to `"unknown"` when null:
```suggestion
private String mapSeverity(String severity) {
if (severity == null || severity.isBlank()) {
return "unknown";
}
return severity.toLowerCase();
}
```
Then update the call sites from `mapSeverity(adv.summary())` to `mapSeverity(adv.severity())`.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24222: Add camel_dependency_security_audit MCP tool [camel]
Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd merged PR #25051:
URL: https://github.com/apache/camel/pull/25051
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24222: Add camel_dependency_security_audit MCP tool [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #25051:
URL: https://github.com/apache/camel/pull/25051#discussion_r3637015935
##########
dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditTools.java:
##########
@@ -0,0 +1,282 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+
+import io.quarkiverse.mcp.server.Tool;
+import io.quarkiverse.mcp.server.ToolArg;
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.tooling.model.ComponentModel;
+import org.apache.camel.tooling.model.SecurityAdvisoryModel;
+
+/**
+ * MCP Tool for performing security vulnerability analysis on Camel project dependencies.
+ * <p>
+ * Distinct from {@link DependencyCheckTools} (dependency hygiene) and {@link AdvisoryTools} (Camel CVE listing), this
+ * tool cross-references a project's declared dependencies with the Camel security advisory database and component
+ * metadata to produce actionable vulnerability findings per artifact.
+ */
+@ApplicationScoped
+public class DependencySecurityAuditTools {
+
+ @Inject
+ CatalogService catalogService;
+
+ @Inject
+ AdvisoryService advisoryService;
+
+ @Tool(annotations = @Tool.Annotations(readOnlyHint = true, destructiveHint = false, openWorldHint = false),
+ description = "Perform a security vulnerability audit on a Camel project's dependencies. "
+ + "Cross-references the project's pom.xml dependencies with the Camel security advisory "
+ + "database to identify CVEs affecting each artifact at the project's Camel version. "
+ + "Reports severity, affected version ranges, fixed versions, and whether the vulnerable "
+ + "component is directly used (reachable) or only a transitive dependency. "
+ + "POM content is automatically sanitized to mask sensitive data.")
+ public AuditResult camel_dependency_security_audit(
+ @ToolArg(description = "The pom.xml file content") String pomContent,
+ @ToolArg(description = "Route definitions (YAML, XML, or Java DSL) to determine which components "
+ + "are actually used (for reachability analysis)") String routes,
+ @ToolArg(description = ToolArgDocs.RUNTIME) String runtime,
+ @ToolArg(description = ToolArgDocs.CAMEL_VERSION) String camelVersion,
+ @ToolArg(description = ToolArgDocs.PLATFORM_BOM) String platformBom,
+ @ToolArg(description = "If true (default), mask credentials in POM content") Boolean sanitizePom) {
+
+ if (pomContent == null || pomContent.isBlank()) {
+ throw new ToolCallException("pomContent is required", null);
+ }
+
+ try {
+ PomSanitizer.ProcessedPom processed = PomSanitizer.process(pomContent, sanitizePom);
+ CamelCatalog catalog = catalogService.loadCatalog(runtime, camelVersion, platformBom);
+ MigrationData.PomAnalysis pom = MigrationData.parsePomContent(processed.content());
+
+ String effectiveVersion = pom.camelVersion() != null ? pom.camelVersion() : catalog.getCatalogVersion();
+
+ List<SecurityAdvisoryModel> allAdvisories = advisoryService.advisories();
+
+ List<String> usedSchemes = routes != null && !routes.isBlank()
+ ? extractUsedSchemes(routes) : List.of();
+
+ Map<String, ArtifactAudit> auditByArtifact = new LinkedHashMap<>();
+
+ for (String dep : pom.dependencies()) {
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, dep, null);
+
+ if (!matched.isEmpty()) {
+ boolean reachable = isReachable(dep, usedSchemes, catalog);
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
+ findings.add(new VulnerabilityFinding(
+ adv.cve(),
+ adv.summary(),
+ mapSeverity(adv.summary()),
+ adv.affected(),
+ adv.fixed(),
+ AdvisoryService.SECURITY_PAGE_URL + adv.cve().toLowerCase().replace("-", "-")));
+ }
+ auditByArtifact.put(dep, new ArtifactAudit(dep, reachable, findings));
+ }
+ }
+
+ for (String compName : catalog.findComponentNames()) {
+ ComponentModel model = catalog.componentModel(compName);
+ if (model == null || model.getArtifactId() == null) {
+ continue;
+ }
+ String artifactId = model.getArtifactId();
+ if (auditByArtifact.containsKey(artifactId)) {
+ continue;
+ }
+
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, artifactId, null);
+ if (!matched.isEmpty()) {
+ boolean reachable = usedSchemes.contains(compName);
+ boolean declaredDep = pom.dependencies().contains(artifactId);
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
Review Comment:
Same as above — use `adv.url()` instead of constructing the URL.
```suggestion
adv.url()));
```
##########
dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditToolsTest.java:
##########
@@ -0,0 +1,148 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+class DependencySecurityAuditToolsTest {
+
+ private static final String SIMPLE_POM = """
+ <project>
+ <properties>
+ <camel.version>4.10.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-http</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private static final String CURRENT_VERSION_POM = """
+ <project>
+ <properties>
+ <camel.version>4.22.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private final DependencySecurityAuditTools tools = createTools();
+
+ private static DependencySecurityAuditTools createTools() {
+ DependencySecurityAuditTools t = new DependencySecurityAuditTools();
+ t.catalogService = new CatalogService();
+ t.advisoryService = new AdvisoryService();
+ return t;
+ }
+
+ @Test
+ void shouldRequirePomContent() {
+ assertThatThrownBy(() -> tools.camel_dependency_security_audit(null, null, null, null, null, null))
+ .isInstanceOf(ToolCallException.class)
+ .hasMessageContaining("pomContent is required");
+ }
+
+ @Test
+ void shouldAuditOlderVersionWithKnownCves() {
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(SIMPLE_POM, null, null, null, null, null);
+
+ assertThat(result).isNotNull();
+ assertThat(result.summary()).isNotNull();
+ assertThat(result.summary().camelVersion()).isEqualTo("4.10.0");
+ assertThat(result.summary().totalDependencies()).isGreaterThan(0);
+ assertThat(result.recommendations()).isNotNull();
+ }
+
+ @Test
+ void shouldReportCleanForCurrentVersion() {
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(CURRENT_VERSION_POM, null, null, null, null, null);
+
+ assertThat(result).isNotNull();
+ assertThat(result.summary()).isNotNull();
+ }
+
+ @Test
+ void shouldIncludeReachabilityWhenRoutesProvided() {
+ String routes = "from: \"http:example.com\"\nsteps:\n - to: \"log:out\"";
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(SIMPLE_POM, routes, null, null, null, null);
Review Comment:
This test verifies reachability analysis when routes are provided, but doesn't assert anything about the reachability result. Consider checking `reachableVulnerableArtifacts` in the summary or verifying that a specific artifact's `reachable` flag is set correctly.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24222: Add camel_dependency_security_audit MCP tool [camel]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on code in PR #25051:
URL: https://github.com/apache/camel/pull/25051#discussion_r3638317811
##########
dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditTools.java:
##########
@@ -0,0 +1,260 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+
+import io.quarkiverse.mcp.server.Tool;
+import io.quarkiverse.mcp.server.ToolArg;
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.tooling.model.ComponentModel;
+import org.apache.camel.tooling.model.SecurityAdvisoryModel;
+
+/**
+ * MCP Tool for performing security vulnerability analysis on Camel project dependencies.
+ * <p>
+ * Distinct from {@link DependencyCheckTools} (dependency hygiene) and {@link AdvisoryTools} (Camel CVE listing), this
+ * tool cross-references a project's declared dependencies with the Camel security advisory database and component
+ * metadata to produce actionable vulnerability findings per artifact.
+ */
+@ApplicationScoped
+public class DependencySecurityAuditTools {
+
+ @Inject
+ CatalogService catalogService;
+
+ @Inject
+ AdvisoryService advisoryService;
+
+ @Tool(annotations = @Tool.Annotations(readOnlyHint = true, destructiveHint = false, openWorldHint = false),
+ description = "Perform a security vulnerability audit on a Camel project's dependencies. "
+ + "Cross-references the project's pom.xml dependencies with the Camel security advisory "
+ + "database to identify CVEs affecting each artifact at the project's Camel version. "
+ + "Reports severity, affected version ranges, fixed versions, and whether the vulnerable "
+ + "component is directly used (reachable) or only a transitive dependency. "
+ + "POM content is automatically sanitized to mask sensitive data.")
+ public AuditResult camel_dependency_security_audit(
+ @ToolArg(description = "The pom.xml file content") String pomContent,
+ @ToolArg(description = "Route definitions (YAML, XML, or Java DSL) to determine which components "
+ + "are actually used (for reachability analysis)") String routes,
+ @ToolArg(description = ToolArgDocs.RUNTIME) String runtime,
+ @ToolArg(description = ToolArgDocs.CAMEL_VERSION) String camelVersion,
+ @ToolArg(description = ToolArgDocs.PLATFORM_BOM) String platformBom,
+ @ToolArg(description = "If true (default), mask credentials in POM content") Boolean sanitizePom) {
+
+ if (pomContent == null || pomContent.isBlank()) {
+ throw new ToolCallException("pomContent is required", null);
+ }
+
+ try {
+ PomSanitizer.ProcessedPom processed = PomSanitizer.process(pomContent, sanitizePom);
+ CamelCatalog catalog = catalogService.loadCatalog(runtime, camelVersion, platformBom);
+ MigrationData.PomAnalysis pom = MigrationData.parsePomContent(processed.content());
+
+ String effectiveVersion = pom.camelVersion() != null ? pom.camelVersion() : catalog.getCatalogVersion();
+
+ List<SecurityAdvisoryModel> allAdvisories = advisoryService.advisories();
+
+ List<String> usedSchemes = routes != null && !routes.isBlank()
+ ? extractUsedSchemes(routes) : List.of();
+
+ Map<String, ArtifactAudit> auditByArtifact = new LinkedHashMap<>();
+
+ for (String dep : pom.dependencies()) {
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, dep, null);
+
+ if (!matched.isEmpty()) {
+ boolean reachable = isReachable(dep, usedSchemes, catalog);
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
+ findings.add(new VulnerabilityFinding(
+ adv.cve(),
+ adv.summary(),
+ adv.severity(),
+ adv.affected(),
+ adv.fixed(),
+ adv.url()));
+ }
+ auditByArtifact.put(dep, new ArtifactAudit(dep, reachable, findings));
+ }
+ }
+
+ for (String compName : catalog.findComponentNames()) {
+ ComponentModel model = catalog.componentModel(compName);
+ if (model == null || model.getArtifactId() == null) {
+ continue;
+ }
+ String artifactId = model.getArtifactId();
+ if (auditByArtifact.containsKey(artifactId)) {
+ continue;
+ }
+
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, artifactId, null);
+ if (!matched.isEmpty() && usedSchemes.contains(compName)) {
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
+ findings.add(new VulnerabilityFinding(
+ adv.cve(), adv.summary(), adv.severity(),
+ adv.affected(), adv.fixed(),
+ adv.url()));
+ }
+ auditByArtifact.put(artifactId, new ArtifactAudit(artifactId, true, findings));
+ }
+ }
+
+ List<ArtifactAudit> vulnerableArtifacts = new ArrayList<>(auditByArtifact.values());
+ int totalCves = vulnerableArtifacts.stream().mapToInt(a -> a.findings().size()).sum();
+ long criticalCount = vulnerableArtifacts.stream()
+ .flatMap(a -> a.findings().stream())
+ .filter(f -> "critical".equals(f.severity()) || "high".equals(f.severity()))
+ .count();
Review Comment:
**Case-sensitive severity comparison will silently produce wrong results.** The advisory data stores severity values as uppercase (`"CRITICAL"`, `"HIGH"`, `"MEDIUM"`, `"LOW"`), but this filter uses lowercase. Since `String.equals()` is case-sensitive, `criticalAndHighCves` will always be 0.
Note: `AdvisoryService.matchesSeverity()` already handles this correctly with `equalsIgnoreCase()` — same pattern needed here.
```suggestion
long criticalCount = vulnerableArtifacts.stream()
.flatMap(a -> a.findings().stream())
.filter(f -> "critical".equalsIgnoreCase(f.severity()) || "high".equalsIgnoreCase(f.severity()))
```
##########
dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditTools.java:
##########
@@ -0,0 +1,260 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+
+import io.quarkiverse.mcp.server.Tool;
+import io.quarkiverse.mcp.server.ToolArg;
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.tooling.model.ComponentModel;
+import org.apache.camel.tooling.model.SecurityAdvisoryModel;
+
+/**
+ * MCP Tool for performing security vulnerability analysis on Camel project dependencies.
+ * <p>
+ * Distinct from {@link DependencyCheckTools} (dependency hygiene) and {@link AdvisoryTools} (Camel CVE listing), this
+ * tool cross-references a project's declared dependencies with the Camel security advisory database and component
+ * metadata to produce actionable vulnerability findings per artifact.
+ */
+@ApplicationScoped
+public class DependencySecurityAuditTools {
+
+ @Inject
+ CatalogService catalogService;
+
+ @Inject
+ AdvisoryService advisoryService;
+
+ @Tool(annotations = @Tool.Annotations(readOnlyHint = true, destructiveHint = false, openWorldHint = false),
+ description = "Perform a security vulnerability audit on a Camel project's dependencies. "
+ + "Cross-references the project's pom.xml dependencies with the Camel security advisory "
+ + "database to identify CVEs affecting each artifact at the project's Camel version. "
+ + "Reports severity, affected version ranges, fixed versions, and whether the vulnerable "
+ + "component is directly used (reachable) or only a transitive dependency. "
+ + "POM content is automatically sanitized to mask sensitive data.")
+ public AuditResult camel_dependency_security_audit(
+ @ToolArg(description = "The pom.xml file content") String pomContent,
+ @ToolArg(description = "Route definitions (YAML, XML, or Java DSL) to determine which components "
+ + "are actually used (for reachability analysis)") String routes,
+ @ToolArg(description = ToolArgDocs.RUNTIME) String runtime,
+ @ToolArg(description = ToolArgDocs.CAMEL_VERSION) String camelVersion,
+ @ToolArg(description = ToolArgDocs.PLATFORM_BOM) String platformBom,
+ @ToolArg(description = "If true (default), mask credentials in POM content") Boolean sanitizePom) {
+
+ if (pomContent == null || pomContent.isBlank()) {
+ throw new ToolCallException("pomContent is required", null);
+ }
+
+ try {
+ PomSanitizer.ProcessedPom processed = PomSanitizer.process(pomContent, sanitizePom);
+ CamelCatalog catalog = catalogService.loadCatalog(runtime, camelVersion, platformBom);
+ MigrationData.PomAnalysis pom = MigrationData.parsePomContent(processed.content());
+
+ String effectiveVersion = pom.camelVersion() != null ? pom.camelVersion() : catalog.getCatalogVersion();
+
+ List<SecurityAdvisoryModel> allAdvisories = advisoryService.advisories();
+
+ List<String> usedSchemes = routes != null && !routes.isBlank()
+ ? extractUsedSchemes(routes) : List.of();
+
+ Map<String, ArtifactAudit> auditByArtifact = new LinkedHashMap<>();
+
+ for (String dep : pom.dependencies()) {
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, dep, null);
+
+ if (!matched.isEmpty()) {
+ boolean reachable = isReachable(dep, usedSchemes, catalog);
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
+ findings.add(new VulnerabilityFinding(
+ adv.cve(),
+ adv.summary(),
+ adv.severity(),
+ adv.affected(),
+ adv.fixed(),
+ adv.url()));
+ }
+ auditByArtifact.put(dep, new ArtifactAudit(dep, reachable, findings));
+ }
+ }
+
+ for (String compName : catalog.findComponentNames()) {
+ ComponentModel model = catalog.componentModel(compName);
+ if (model == null || model.getArtifactId() == null) {
+ continue;
+ }
+ String artifactId = model.getArtifactId();
+ if (auditByArtifact.containsKey(artifactId)) {
+ continue;
+ }
+
+ List<AdvisoryService.AdvisoryView> matched
+ = AdvisoryService.query(allAdvisories, effectiveVersion, artifactId, null);
+ if (!matched.isEmpty() && usedSchemes.contains(compName)) {
+ List<VulnerabilityFinding> findings = new ArrayList<>();
+ for (AdvisoryService.AdvisoryView adv : matched) {
+ findings.add(new VulnerabilityFinding(
+ adv.cve(), adv.summary(), adv.severity(),
+ adv.affected(), adv.fixed(),
+ adv.url()));
+ }
+ auditByArtifact.put(artifactId, new ArtifactAudit(artifactId, true, findings));
+ }
+ }
+
+ List<ArtifactAudit> vulnerableArtifacts = new ArrayList<>(auditByArtifact.values());
+ int totalCves = vulnerableArtifacts.stream().mapToInt(a -> a.findings().size()).sum();
+ long criticalCount = vulnerableArtifacts.stream()
+ .flatMap(a -> a.findings().stream())
+ .filter(f -> "critical".equals(f.severity()) || "high".equals(f.severity()))
+ .count();
+ long reachableCount = vulnerableArtifacts.stream().filter(ArtifactAudit::reachable).count();
+
+ List<String> recommendations = buildRecommendations(vulnerableArtifacts, effectiveVersion, catalog);
+
+ AuditSummary summary = new AuditSummary(
+ effectiveVersion,
+ pom.dependencies().size(),
+ vulnerableArtifacts.size(),
+ totalCves,
+ (int) criticalCount,
+ (int) reachableCount,
+ totalCves == 0);
+
+ return new AuditResult(
+ processed.warnings().isEmpty() ? null : processed.warnings(),
+ vulnerableArtifacts.isEmpty() ? null : vulnerableArtifacts,
+ recommendations.isEmpty() ? null : recommendations,
+ summary);
+
+ } catch (ToolCallException e) {
+ throw e;
+ } catch (Throwable e) {
+ throw new ToolCallException(
+ "Failed to audit dependencies (" + e.getClass().getName() + "): " + e.getMessage(), null);
+ }
+ }
+
+ private List<String> extractUsedSchemes(String routes) {
+ List<String> schemes = new ArrayList<>();
+ String lower = routes.toLowerCase();
+ for (String token : lower.split("[^a-z0-9-]+")) {
+ if (token.length() > 2 && lower.contains(token + ":")) {
+ if (!schemes.contains(token)) {
+ schemes.add(token);
+ }
+ }
+ }
+ return schemes;
+ }
+
+ private boolean isReachable(String artifactId, List<String> usedSchemes, CamelCatalog catalog) {
+ if (usedSchemes.isEmpty()) {
+ return true;
+ }
+ for (String scheme : usedSchemes) {
+ ComponentModel model = catalog.componentModel(scheme);
+ if (model != null && artifactId.equals(model.getArtifactId())) {
+ return true;
+ }
+ }
+ String schemeName = artifactId.replace("camel-", "");
+ return usedSchemes.contains(schemeName);
+ }
+
+ private List<String> buildRecommendations(
+ List<ArtifactAudit> vulnerableArtifacts, String version, CamelCatalog catalog) {
+ List<String> recs = new ArrayList<>();
+
+ boolean hasCritical = vulnerableArtifacts.stream()
+ .flatMap(a -> a.findings().stream())
+ .anyMatch(f -> "critical".equals(f.severity()));
Review Comment:
Same case-sensitivity issue here — `"critical".equals(f.severity())` will never match the uppercase `"CRITICAL"` from the advisory data, so the `"URGENT"` recommendation will never trigger.
```suggestion
.anyMatch(f -> "critical".equalsIgnoreCase(f.severity()));
```
##########
dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/DependencySecurityAuditToolsTest.java:
##########
@@ -0,0 +1,150 @@
+/*
+ * 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.dsl.jbang.core.commands.mcp;
+
+import io.quarkiverse.mcp.server.ToolCallException;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+class DependencySecurityAuditToolsTest {
+
+ private static final String SIMPLE_POM = """
+ <project>
+ <properties>
+ <camel.version>4.10.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-http</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private static final String CURRENT_VERSION_POM = """
+ <project>
+ <properties>
+ <camel.version>4.22.0</camel.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ </dependencies>
+ </project>
+ """;
+
+ private final DependencySecurityAuditTools tools = createTools();
+
+ private static DependencySecurityAuditTools createTools() {
+ DependencySecurityAuditTools t = new DependencySecurityAuditTools();
+ t.catalogService = new CatalogService();
+ t.advisoryService = new AdvisoryService();
+ return t;
+ }
+
+ @Test
+ void shouldRequirePomContent() {
+ assertThatThrownBy(() -> tools.camel_dependency_security_audit(null, null, null, null, null, null))
+ .isInstanceOf(ToolCallException.class)
+ .hasMessageContaining("pomContent is required");
+ }
+
+ @Test
+ void shouldAuditOlderVersionWithKnownCves() {
+ DependencySecurityAuditTools.AuditResult result
+ = tools.camel_dependency_security_audit(SIMPLE_POM, null, null, null, null, null);
+
+ assertThat(result).isNotNull();
Review Comment:
Minor: `shouldAuditOlderVersionWithKnownCves` doesn't assert that any CVEs were actually found (e.g., `totalCves > 0`). The test would pass even if the matching logic returned zero findings, weakening it as a regression guard.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-24222: Add camel_dependency_security_audit MCP tool [camel]
Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd commented on PR #25051:
URL: https://github.com/apache/camel/pull/25051#issuecomment-5059023211
Re-review findings addressed:
1. ✅ Fixed case-sensitive severity comparison — both `criticalCount` filter and `URGENT` recommendation now use `equalsIgnoreCase()` to match uppercase `"CRITICAL"`/`"HIGH"` from advisory data
2. ✅ Strengthened test assertion for older version audit
_Claude Code on behalf of oscerd_
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org