This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new d9518fa71ff6 CAMEL-27348: camel-jbang - CVE audit checks the Apache
Camel security advisories online from camel-website, with the catalog as the
fallback (#30562)
d9518fa71ff6 is described below
commit d9518fa71ff6ee415572120969ae2d26b6ef138a
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Nov 22 15:07:24 2026 +0100
CAMEL-27348: camel-jbang - CVE audit checks the Apache Camel security
advisories online from camel-website, with the catalog as the fallback (#30562)
The CVE audit checked the Camel JARs only against the Apache Camel security
advisories that ship with the catalog, which are as new as the release. It
now also reads them online from the camel-website repository on GitHub
(content/security/CVE-*.md) and merges both by CVE id, the online one
winning, with the catalog as the fallback.
OnlineAdvisories (camel-catalog-cve) lists content/security with one GitHub
API call and downloads only new or changed advisories. The result is cached
in ~/.camel/advisories and checked again once a day. When the check fails,
the copy of the day before is used, else the catalog, with a warning. A
mirror (URL or file of a JSON array in the catalog format) serves machines
without GitHub access; the Maven settings proxy or HTTPS_PROXY is used. No
project coordinates are sent.
The advisory Markdown parser moves from the update-security-advisories goal
to camel-tooling-model (SecurityAdvisoryParser), so the build and the audit
read the advisories the same way.
camel dependency audit gets --advisories-url (--offline checks the catalog
only) and camelAdvisories in --json; the TUI CVE Audit screen and the
camel-report:audit goal (advisoriesUrl, advisoriesCache, offline) do the
same. HttpProxy.authenticator() now allows Basic for the proxy tunnel, so
every client built with it does. Docs updated.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
catalog/camel-catalog-cve/pom.xml | 6 +
.../org/apache/camel/catalog/cve/CveAudit.java | 19 +-
.../apache/camel/catalog/cve/OnlineAdvisories.java | 330 +++++++++++++++++++++
.../camel/catalog/cve/OnlineAdvisoriesTest.java | 236 +++++++++++++++
.../src/main/docs/camel-report-maven-plugin.adoc | 11 +-
.../java/org/apache/camel/maven/AuditMojo.java | 33 ++-
.../modules/ROOT/pages/camel-jbang-projects.adoc | 24 +-
.../ROOT/pages/camel-jbang-tui-observe.adoc | 5 +-
.../ROOT/pages/camel-report-maven-plugin.adoc | 11 +-
.../camel-jbang-dependency-audit.adoc | 3 +-
.../META-INF/camel-jbang-commands-metadata.json | 2 +-
.../dsl/jbang/core/commands/DependencyAudit.java | 58 +++-
.../jbang/core/commands/DependencyAuditTest.java | 28 ++
.../src/test/resources/golden/cli-help.txt | 12 +-
.../dsl/jbang/core/commands/tui/CveAuditTab.java | 25 +-
.../dsl/jbang/core/commands/tui/TuiSettings.java | 13 +
.../src/main/resources/tui/help/cve-audit.md | 4 +-
.../core/commands/tui/CveAuditTabViewsTest.java | 15 +
tooling/camel-tooling-model/pom.xml | 12 +
.../tooling/model/SecurityAdvisoryParser.java} | 115 +------
.../tooling/model/SecurityAdvisoryParserTest.java} | 28 +-
.../resources/security-advisories/CVE-2013-4330.md | 0
.../security-advisories/CVE-2025-27636.md | 0
.../packaging/UpdateSecurityAdvisoriesMojo.java | 130 +-------
24 files changed, 855 insertions(+), 265 deletions(-)
diff --git a/catalog/camel-catalog-cve/pom.xml
b/catalog/camel-catalog-cve/pom.xml
index a04c8610a6aa..774bce429be3 100644
--- a/catalog/camel-catalog-cve/pom.xml
+++ b/catalog/camel-catalog-cve/pom.xml
@@ -46,6 +46,12 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-util-json</artifactId>
</dependency>
+ <!-- the advisories of camel-website, checked online
(SecurityAdvisoryParser of camel-tooling-model) -->
+ <dependency>
+ <groupId>org.snakeyaml</groupId>
+ <artifactId>snakeyaml-engine</artifactId>
+ <version>${snakeyaml-engine-version}</version>
+ </dependency>
<!-- ComparableVersion, to compare the versions of the affected ranges
-->
<dependency>
<groupId>org.apache.maven</groupId>
diff --git
a/catalog/camel-catalog-cve/src/main/java/org/apache/camel/catalog/cve/CveAudit.java
b/catalog/camel-catalog-cve/src/main/java/org/apache/camel/catalog/cve/CveAudit.java
index d2ef19619949..e91f797031d2 100644
---
a/catalog/camel-catalog-cve/src/main/java/org/apache/camel/catalog/cve/CveAudit.java
+++
b/catalog/camel-catalog-cve/src/main/java/org/apache/camel/catalog/cve/CveAudit.java
@@ -64,11 +64,25 @@ public final class CveAudit {
public static Result audit(
List<Dependency> deps, Map<String, Path> jars, Set<String>
declared, Map<String, String> fallbackVia,
Collection<String> endpointComponents, CamelCatalog catalog,
VulnerabilitySource osv) {
+ return audit(deps, jars, declared, fallbackVia, endpointComponents,
catalog, advisories(catalog), osv);
+ }
+
+ /**
+ * Audits the JARs, with the given Apache Camel security advisories, such
as those checked online
+ * ({@link OnlineAdvisories}) instead of those of the catalog.
+ *
+ * @param advisories the Apache Camel security advisories
+ * @see #audit(List, Map, Set, Map, Collection, CamelCatalog,
VulnerabilitySource)
+ */
+ public static Result audit(
+ List<Dependency> deps, Map<String, Path> jars, Set<String>
declared, Map<String, String> fallbackVia,
+ Collection<String> endpointComponents, CamelCatalog catalog,
List<SecurityAdvisoryModel> advisories,
+ VulnerabilitySource osv) {
Map<String, List<OsvClient.Vulnerability>> vulnMap = osv != null ?
osv.queryBatch(deps) : Map.of();
String osvError = osv != null ? osv.lastError() : null;
List<CveFinding> findings = CveScan.buildCveFindings(vulnMap,
Map.of());
- findings = CveScan.applyCamelAdvisories(findings, deps,
advisories(catalog));
+ findings = CveScan.applyCamelAdvisories(findings, deps, advisories);
if (!findings.isEmpty()) {
Map<String, List<String>> chains = chains(jars, declared,
findings);
CveScan.attachChains(findings, chains, fallbackVia, declared);
@@ -81,7 +95,8 @@ public final class CveAudit {
return new Result(findings, CveScan.artifactRows(findings), osvError);
}
- private static List<SecurityAdvisoryModel> advisories(CamelCatalog
catalog) {
+ /** The Apache Camel security advisories of the catalog. */
+ public static List<SecurityAdvisoryModel> advisories(CamelCatalog catalog)
{
try {
return catalog.camelSecurityAdvisories();
} catch (Exception e) {
diff --git
a/catalog/camel-catalog-cve/src/main/java/org/apache/camel/catalog/cve/OnlineAdvisories.java
b/catalog/camel-catalog-cve/src/main/java/org/apache/camel/catalog/cve/OnlineAdvisories.java
new file mode 100644
index 000000000000..e99770d32829
--- /dev/null
+++
b/catalog/camel-catalog-cve/src/main/java/org/apache/camel/catalog/cve/OnlineAdvisories.java
@@ -0,0 +1,330 @@
+/*
+ * 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.catalog.cve;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.net.ProxySelector;
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.AtomicMoveNotSupportedException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
+import java.security.MessageDigest;
+import java.time.Duration;
+import java.time.Instant;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.HexFormat;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.CompletableFuture;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.camel.tooling.model.JsonMapper;
+import org.apache.camel.tooling.model.SecurityAdvisoryModel;
+import org.apache.camel.tooling.model.SecurityAdvisoryParser;
+import org.apache.camel.util.json.JsonArray;
+import org.apache.camel.util.json.JsonObject;
+import org.apache.camel.util.json.Jsoner;
+
+/**
+ * The Apache Camel security advisories, checked online (CAMEL-27348): the
advisories published in the camel-website
+ * repository ({@code content/security/CVE-*.md}, the source of
camel.apache.org/security) merged with those of the
+ * catalog, so an older CLI or plugin knows the advisories published after its
release. One GitHub API call lists the
+ * advisories, and only the new and changed files (by their sha) are
downloaded. The result is cached and refreshed once
+ * a day; when the refresh fails, the cached copy is used, else the advisories
of the catalog only, with a warning.
+ * <p>
+ * The location can also be a mirror: a URL or a file of a JSON array in the
format of the catalog
+ * ({@code camel-security-advisories.json}), for machines without access to
GitHub.
+ */
+public final class OnlineAdvisories {
+
+ /** The advisories of camel-website, listed by the GitHub contents API. */
+ public static final String DEFAULT_URL =
"https://api.github.com/repos/apache/camel-website/contents/content/security";
+
+ /** How long the advisories checked online are used before they are
checked again. */
+ public static final Duration DEFAULT_MAX_AGE = Duration.ofDays(1);
+
+ private static final String GITHUB_API = "https://api.github.com/";
+ private static final Pattern CVE_ID =
Pattern.compile("CVE-(\\d{4})-(\\d+)");
+ // downloads at the same time, to be gentle with raw.githubusercontent.com
+ private static final int PARALLEL = 8;
+
+ private OnlineAdvisories() {
+ }
+
+ /**
+ * The advisories to check: those of the catalog merged with those checked
online, by CVE id (the online one wins).
+ *
+ * @param online how many advisories came from the online copy; 0 when
only those of the catalog are used
+ * @param updated when the online copy was checked; null when there is none
+ * @param warning why the online copy is older, or missing; null when it
is up to date
+ */
+ public record Result(List<SecurityAdvisoryModel> advisories, int online,
Instant updated, String warning) {
+ }
+
+ /**
+ * The advisories of the catalog merged with those of the location.
+ *
+ * @param location the GitHub contents API of the advisories ({@link
#DEFAULT_URL} when null), or the URL or file of
+ * a JSON array in the format of the catalog
+ * @param cacheDir where the advisories checked online are kept
+ * @param maxAge how long they are used before they are checked again
+ * @param proxy the proxy to reach the location through; null for the
proxy settings of the JVM
+ * @param catalog the advisories of the catalog
+ */
+ public static Result load(
+ String location, Path cacheDir, Duration maxAge, HttpProxy proxy,
List<SecurityAdvisoryModel> catalog) {
+ String where = location != null && !location.isBlank() ?
location.trim() : DEFAULT_URL;
+ Path cached = cacheDir.resolve(cacheName(where) + ".json");
+ Path shas = cacheDir.resolve(cacheName(where) + ".sha");
+ String warning = null;
+ try {
+ if (!where.startsWith("http://") && !where.startsWith("https://"))
{
+ Path file = where.startsWith("file:") ?
Path.of(URI.create(where)) : Path.of(where);
+ return merged(catalog, readJson(Files.readString(file)),
modified(file), null);
+ }
+ if (!Files.isRegularFile(cached) || age(cached).compareTo(maxAge)
>= 0) {
+ refresh(where, cached, shas, proxy);
+ }
+ } catch (Exception e) {
+ if (e instanceof InterruptedException) {
+ Thread.currentThread().interrupt();
+ }
+ warning = "The Apache Camel security advisories could not be
checked online at " + where
+ + (proxy != null ? " through the proxy " + proxy : "") +
": "
+ + (e.getMessage() != null ? e.getMessage() :
e.getClass().getSimpleName());
+ }
+ try {
+ if (Files.isRegularFile(cached)) {
+ return merged(catalog, readJson(Files.readString(cached)),
modified(cached),
+ warning != null ? warning + "; the copy of " +
modified(cached) + " is used" : null);
+ }
+ } catch (Exception e) {
+ warning = "The Apache Camel security advisories checked online
could not be read: " + e.getMessage();
+ }
+ return new Result(
+ catalog, 0, null,
+ (warning != null ? warning : "No Apache Camel security
advisories checked online")
+ + "; those of the catalog are used");
+ }
+
+ private static Result merged(
+ List<SecurityAdvisoryModel> catalog, List<SecurityAdvisoryModel>
online, Instant updated, String warning) {
+ Map<String, SecurityAdvisoryModel> byCve = new LinkedHashMap<>();
+ for (SecurityAdvisoryModel a : catalog) {
+ byCve.put(a.getCve(), a);
+ }
+ for (SecurityAdvisoryModel a : online) {
+ byCve.put(a.getCve(), a);
+ }
+ List<SecurityAdvisoryModel> answer = new ArrayList<>(byCve.values());
+ answer.sort(Comparator.comparingLong(OnlineAdvisories::cveOrdinal));
+ return new Result(answer, online.size(), updated, warning);
+ }
+
+ /** Checks the location again, and writes the advisories into the cache. */
+ private static void refresh(String url, Path cached, Path shas, HttpProxy
proxy) throws Exception {
+ HttpClient.Builder builder = HttpClient.newBuilder()
+ .connectTimeout(Duration.ofSeconds(10))
+ .followRedirects(HttpClient.Redirect.NORMAL)
+ .proxy(proxy != null ? proxy.selector() :
ProxySelector.getDefault());
+ if (proxy != null && proxy.authenticator() != null) {
+ HttpProxy.allowBasicTunneling();
+ builder.authenticator(proxy.authenticator());
+ }
+ try (HttpClient client = builder.build()) {
+ String json = get(client, url);
+ JsonArray array = (JsonArray) Jsoner.deserialize(json);
+ if (!array.isEmpty() && array.get(0) instanceof JsonObject first
&& first.containsKey("download_url")) {
+ // the listing of a folder of the GitHub contents API, such as
the one of camel-website
+ refreshFromListing(client, url, array, cached, shas);
+ } else {
+ // a mirror in the format of the catalog
+ if (readJson(json).isEmpty()) {
+ throw new IOException("no advisories at " + url);
+ }
+ write(cached, json);
+ }
+ }
+ }
+
+ private static void refreshFromListing(HttpClient client, String url,
JsonArray listing, Path cached, Path shas)
+ throws Exception {
+ // the advisories downloaded before, by file name, with the sha of the
file
+ Properties knownShas = new Properties();
+ Map<String, SecurityAdvisoryModel> known = new LinkedHashMap<>();
+ if (Files.isRegularFile(shas) && Files.isRegularFile(cached)) {
+ try (Reader r = Files.newBufferedReader(shas)) {
+ knownShas.load(r);
+ }
+ for (SecurityAdvisoryModel a : readJson(Files.readString(cached)))
{
+ known.put(a.getCve() + ".md", a);
+ }
+ }
+ Properties newShas = new Properties();
+ Map<String, SecurityAdvisoryModel> result = new LinkedHashMap<>();
+ Map<String, String> toDownload = new LinkedHashMap<>();
+ for (Object o : listing) {
+ JsonObject file = (JsonObject) o;
+ String name = file.getString("name");
+ String sha = file.getString("sha");
+ String download = file.getString("download_url");
+ if (name == null || download == null ||
!SecurityAdvisoryParser.ADVISORY_FILE.matcher(name).matches()) {
+ continue;
+ }
+ if (sha != null) {
+ newShas.setProperty(name, sha);
+ }
+ if (sha != null && sha.equals(knownShas.getProperty(name))) {
+ // unchanged: as downloaded before (a draft has no advisory)
+ SecurityAdvisoryModel before = known.get(name);
+ if (before != null) {
+ result.put(name, before);
+ }
+ } else {
+ toDownload.put(name, download);
+ }
+ }
+ if (newShas.isEmpty()) {
+ throw new IOException("no advisories listed at " + url);
+ }
+ List<String> names = new ArrayList<>(toDownload.keySet());
+ for (int i = 0; i < names.size(); i += PARALLEL) {
+ List<String> batch = names.subList(i, Math.min(names.size(), i +
PARALLEL));
+ List<CompletableFuture<HttpResponse<String>>> futures = new
ArrayList<>();
+ for (String name : batch) {
+ futures.add(client.sendAsync(request(toDownload.get(name)),
HttpResponse.BodyHandlers.ofString()));
+ }
+ for (int j = 0; j < batch.size(); j++) {
+ HttpResponse<String> res = futures.get(j).get();
+ if (res.statusCode() != 200) {
+ throw new IOException("HTTP status " + res.statusCode() +
" downloading " + toDownload.get(batch.get(j)));
+ }
+ SecurityAdvisoryModel model =
SecurityAdvisoryParser.parse(res.body());
+ if (model != null) {
+ result.put(batch.get(j), model);
+ }
+ }
+ }
+ JsonArray arr = new JsonArray();
+
result.values().stream().sorted(Comparator.comparingLong(OnlineAdvisories::cveOrdinal))
+ .forEach(a -> arr.add(JsonMapper.asJsonObject(a)));
+ write(cached, Jsoner.prettyPrint(Jsoner.serialize(arr), 4));
+ StringWriter w = new StringWriter();
+ newShas.store(w, "the sha of the advisories of " + url);
+ // write() leaves no temporary file behind when the write or move fails
+ write(shas, w.toString());
+ }
+
+ private static String get(HttpClient client, String url) throws
IOException, InterruptedException {
+ HttpResponse<String> res = client.send(request(url),
HttpResponse.BodyHandlers.ofString());
+ if (res.statusCode() == 403 || res.statusCode() == 429) {
+ throw new IOException(
+ "HTTP status " + res.statusCode() + " (rate limited: set
the GITHUB_TOKEN environment"
+ + " variable)");
+ }
+ if (res.statusCode() == 407) {
+ throw new IOException("the proxy needs a username and password
(HTTP status 407)");
+ }
+ if (res.statusCode() != 200) {
+ throw new IOException("HTTP status " + res.statusCode());
+ }
+ return res.body();
+ }
+
+ private static HttpRequest request(String url) {
+ HttpRequest.Builder builder =
HttpRequest.newBuilder(URI.create(url)).timeout(Duration.ofSeconds(30));
+ String token = System.getenv("GITHUB_TOKEN");
+ if (url.startsWith(GITHUB_API) && token != null && !token.isBlank()) {
+ builder.header("Authorization", "Bearer " + token.trim());
+ }
+ return builder.build();
+ }
+
+ /** The advisories of a JSON array in the format of the catalog. */
+ static List<SecurityAdvisoryModel> readJson(String json) throws Exception {
+ List<SecurityAdvisoryModel> answer = new ArrayList<>();
+ for (Object o : (JsonArray) Jsoner.deserialize(json)) {
+ SecurityAdvisoryModel model =
JsonMapper.generateSecurityAdvisoryModel((JsonObject) o);
+ if (model.getCve() != null) {
+ answer.add(model);
+ }
+ }
+ return answer;
+ }
+
+ private static void write(Path file, String text) throws IOException {
+ Files.createDirectories(file.getParent());
+ Path tmp = Files.createTempFile(file.getParent(),
file.getFileName().toString(), ".tmp");
+ try {
+ Files.writeString(tmp, text);
+ move(tmp, file);
+ } finally {
+ // a failed write or move leaves no temporary file in the cache
+ Files.deleteIfExists(tmp);
+ }
+ }
+
+ private static void move(Path tmp, Path target) throws IOException {
+ try {
+ Files.move(tmp, target, StandardCopyOption.REPLACE_EXISTING,
StandardCopyOption.ATOMIC_MOVE);
+ } catch (AtomicMoveNotSupportedException e) {
+ Files.move(tmp, target, StandardCopyOption.REPLACE_EXISTING);
+ }
+ }
+
+ // one cached copy per location
+ static String cacheName(String location) {
+ try {
+ byte[] hash =
MessageDigest.getInstance("SHA-256").digest(location.getBytes(StandardCharsets.UTF_8));
+ return "advisories-" + HexFormat.of().formatHex(hash, 0, 8);
+ } catch (Exception e) {
+ return "advisories-" + Integer.toHexString(location.hashCode());
+ }
+ }
+
+ private static long cveOrdinal(SecurityAdvisoryModel advisory) {
+ Matcher matcher = CVE_ID.matcher(advisory.getCve() == null ? "" :
advisory.getCve());
+ if (matcher.find()) {
+ return Long.parseLong(matcher.group(1)) * 1_000_000L +
Long.parseLong(matcher.group(2));
+ }
+ return 0;
+ }
+
+ private static Instant modified(Path file) {
+ try {
+ return Files.getLastModifiedTime(file).toInstant();
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ private static Duration age(Path file) {
+ Instant m = modified(file);
+ return m != null ? Duration.between(m, Instant.now()) :
Duration.ofDays(36500);
+ }
+}
diff --git
a/catalog/camel-catalog-cve/src/test/java/org/apache/camel/catalog/cve/OnlineAdvisoriesTest.java
b/catalog/camel-catalog-cve/src/test/java/org/apache/camel/catalog/cve/OnlineAdvisoriesTest.java
new file mode 100644
index 000000000000..a591a16cc525
--- /dev/null
+++
b/catalog/camel-catalog-cve/src/test/java/org/apache/camel/catalog/cve/OnlineAdvisoriesTest.java
@@ -0,0 +1,236 @@
+/*
+ * 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.catalog.cve;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.attribute.FileTime;
+import java.time.Duration;
+import java.time.Instant;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.IntSupplier;
+import java.util.function.Supplier;
+import java.util.stream.Stream;
+
+import com.sun.net.httpserver.HttpServer;
+import org.apache.camel.tooling.model.SecurityAdvisoryModel;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * CAMEL-27348: the Apache Camel security advisories checked online, merged
with those of the catalog, cached, and
+ * refreshed with only the changed files downloaded.
+ */
+class OnlineAdvisoriesTest {
+
+ private static final String PUBLISHED = """
+ ---
+ title: "Apache Camel Security Advisory - CVE-2026-10001"
+ url: /security/CVE-2026-10001.html
+ draft: false
+ type: security-advisory
+ cve: CVE-2026-10001
+ severity: HIGH
+ summary: "Camel-Kafka: a header is evaluated"
+ affected: "From 4.8.0 before 4.18.5"
+ fixed: 4.18.5 and 4.23.0
+ ---
+ """;
+ private static final String DRAFT = """
+ ---
+ draft: true
+ type: security-advisory
+ cve: CVE-2026-10002
+ severity: CRITICAL
+ ---
+ """;
+
+ @TempDir
+ Path dir;
+
+ private HttpServer server;
+ private String base;
+ private final Map<String, AtomicInteger> requests = new
ConcurrentHashMap<>();
+ private volatile String sha1 = "aaa";
+ private volatile int listingStatus = 200;
+
+ @BeforeEach
+ void start() throws IOException {
+ server = HttpServer.create(new
InetSocketAddress(InetAddress.getLoopbackAddress(), 0), 0);
+ serve("/listing", () -> listingStatus, () -> """
+ [{"name": "CVE-2026-10001.md", "sha": "%1$s", "download_url":
"%2$s/raw/CVE-2026-10001.md"},
+ {"name": "CVE-2026-10002.md", "sha": "bbb", "download_url":
"%2$s/raw/CVE-2026-10002.md"},
+ {"name": "_index.md", "sha": "ccc", "download_url":
"%2$s/raw/_index.md"}]""".formatted(sha1, base));
+ serve("/raw/CVE-2026-10001.md", () -> 200, () -> PUBLISHED);
+ serve("/raw/CVE-2026-10002.md", () -> 200, () -> DRAFT);
+ serve("/mirror.json", () -> 200, () -> """
+ [{"cve": "CVE-2026-10003", "severity": "LOW", "affected":
"4.20.0", "components": ["camel-file"]}]""");
+ server.start();
+ base = "http://127.0.0.1:" + server.getAddress().getPort();
+ }
+
+ @AfterEach
+ void stop() {
+ server.stop(0);
+ }
+
+ private void serve(String path, IntSupplier status, Supplier<String> body)
{
+ server.createContext(path, exchange -> {
+ requests.computeIfAbsent(path, k -> new
AtomicInteger()).incrementAndGet();
+ byte[] bytes = body.get().getBytes(StandardCharsets.UTF_8);
+ exchange.sendResponseHeaders(status.getAsInt(), bytes.length);
+ try (OutputStream out = exchange.getResponseBody()) {
+ out.write(bytes);
+ }
+ });
+ }
+
+ private int count(String path) {
+ AtomicInteger n = requests.get(path);
+ return n != null ? n.get() : 0;
+ }
+
+ private static SecurityAdvisoryModel advisory(String cve, String severity)
{
+ SecurityAdvisoryModel a = new SecurityAdvisoryModel();
+ a.setCve(cve);
+ a.setSeverity(severity);
+ return a;
+ }
+
+ private static List<String> cves(OnlineAdvisories.Result result) {
+ return
result.advisories().stream().map(SecurityAdvisoryModel::getCve).toList();
+ }
+
+ @Test
+ void mergesTheOnlineAdvisoriesWithThoseOfTheCatalog() {
+ List<SecurityAdvisoryModel> catalog =
List.of(advisory("CVE-2013-4330", "CRITICAL"), advisory("CVE-2026-10001",
"LOW"));
+
+ OnlineAdvisories.Result result
+ = OnlineAdvisories.load(base + "/listing", dir,
Duration.ofDays(1), null, catalog);
+
+ assertThat(result.warning()).isNull();
+ // the draft is left out, and the online CVE-2026-10001 wins over the
one of the catalog
+ assertThat(cves(result)).containsExactly("CVE-2013-4330",
"CVE-2026-10001");
+ assertThat(result.advisories().get(1).getSeverity()).isEqualTo("HIGH");
+
assertThat(result.advisories().get(1).getUrl()).isEqualTo("https://camel.apache.org/security/CVE-2026-10001.html");
+
assertThat(result.advisories().get(1).getComponents()).containsExactly("camel-kafka");
+ assertThat(result.online()).isEqualTo(1);
+ assertThat(result.updated()).isNotNull();
+ }
+
+ @Test
+ void downloadsOnlyTheChangedFiles() throws Exception {
+ OnlineAdvisories.load(base + "/listing", dir, Duration.ofDays(1),
null, List.of());
+ assertThat(count("/listing")).isEqualTo(1);
+ assertThat(count("/raw/CVE-2026-10001.md")).isEqualTo(1);
+ assertThat(count("/raw/CVE-2026-10002.md")).isEqualTo(1);
+ assertThat(count("/raw/_index.md")).isZero();
+
+ // within a day: the cached copy, without a request
+ OnlineAdvisories.load(base + "/listing", dir, Duration.ofDays(1),
null, List.of());
+ assertThat(count("/listing")).isEqualTo(1);
+
+ // a day later, nothing changed: only the listing (and the draft is
not downloaded again)
+ expire();
+ OnlineAdvisories.Result unchanged = OnlineAdvisories.load(base +
"/listing", dir, Duration.ofDays(1), null, List.of());
+ assertThat(count("/listing")).isEqualTo(2);
+ assertThat(count("/raw/CVE-2026-10001.md")).isEqualTo(1);
+ assertThat(count("/raw/CVE-2026-10002.md")).isEqualTo(1);
+ assertThat(cves(unchanged)).containsExactly("CVE-2026-10001");
+
+ // the advisory was changed: downloaded again
+ expire();
+ sha1 = "ddd";
+ OnlineAdvisories.load(base + "/listing", dir, Duration.ofDays(1),
null, List.of());
+ assertThat(count("/raw/CVE-2026-10001.md")).isEqualTo(2);
+ }
+
+ @Test
+ void usesTheCopyOfTheDayBeforeWhenTheRefreshFails() throws Exception {
+ OnlineAdvisories.load(base + "/listing", dir, Duration.ofDays(1),
null, List.of());
+ expire();
+ listingStatus = 403;
+
+ OnlineAdvisories.Result result = OnlineAdvisories.load(base +
"/listing", dir, Duration.ofDays(1), null, List.of());
+
+ assertThat(result.warning()).contains("could not be checked
online").contains("GITHUB_TOKEN").contains("is used");
+ assertThat(cves(result)).containsExactly("CVE-2026-10001");
+ assertThat(result.online()).isEqualTo(1);
+ }
+
+ @Test
+ void usesTheCatalogWithoutAnyCopy() {
+ listingStatus = 500;
+ List<SecurityAdvisoryModel> catalog =
List.of(advisory("CVE-2013-4330", "CRITICAL"));
+
+ OnlineAdvisories.Result result = OnlineAdvisories.load(base +
"/listing", dir, Duration.ofDays(1), null, catalog);
+
+ assertThat(cves(result)).containsExactly("CVE-2013-4330");
+ assertThat(result.online()).isZero();
+ assertThat(result.updated()).isNull();
+ assertThat(result.warning()).contains("HTTP status
500").contains("those of the catalog are used");
+ }
+
+ @Test
+ void aFailedWriteLeavesNoTemporaryFile() throws Exception {
+ // the cached copy cannot be replaced: its place is taken by a
directory that is not empty
+ Path cached = dir.resolve(OnlineAdvisories.cacheName(base +
"/listing") + ".json");
+ Files.createDirectories(cached);
+ Files.writeString(cached.resolve("keep.txt"), "x");
+
+ OnlineAdvisories.Result result = OnlineAdvisories.load(base +
"/listing", dir, Duration.ofDays(1), null, List.of());
+
+ assertThat(result.warning()).contains("could not be checked
online").contains("those of the catalog are used");
+ try (Stream<Path> files = Files.list(dir)) {
+ assertThat(files.map(p -> p.getFileName().toString())).noneMatch(n
-> n.endsWith(".tmp"));
+ }
+ }
+
+ @Test
+ void readsAMirrorOrAFileInTheFormatOfTheCatalog() throws Exception {
+ OnlineAdvisories.Result mirror = OnlineAdvisories.load(base +
"/mirror.json", dir, Duration.ofDays(1), null,
+ List.of(advisory("CVE-2013-4330", "CRITICAL")));
+ assertThat(mirror.warning()).isNull();
+ assertThat(cves(mirror)).containsExactly("CVE-2013-4330",
"CVE-2026-10003");
+
+ Path file = Files.writeString(dir.resolve("advisories.json"), """
+ [{"cve": "CVE-2026-10004", "severity": "MEDIUM"}]""");
+ OnlineAdvisories.Result local = OnlineAdvisories.load(file.toString(),
dir, Duration.ofDays(1), null, List.of());
+ assertThat(cves(local)).containsExactly("CVE-2026-10004");
+ }
+
+ // the cached copy is two days old
+ private void expire() throws IOException {
+ try (var files = Files.list(dir)) {
+ for (Path f : files.toList()) {
+ Files.setLastModifiedTime(f,
FileTime.from(Instant.now().minus(Duration.ofDays(2))));
+ }
+ }
+ }
+}
diff --git
a/catalog/camel-report-maven-plugin/src/main/docs/camel-report-maven-plugin.adoc
b/catalog/camel-report-maven-plugin/src/main/docs/camel-report-maven-plugin.adoc
index 56b9e00527bb..13b3e95da7e9 100644
---
a/catalog/camel-report-maven-plugin/src/main/docs/camel-report-maven-plugin.adoc
+++
b/catalog/camel-report-maven-plugin/src/main/docs/camel-report-maven-plugin.adoc
@@ -271,8 +271,11 @@ Or run it in every build, in the `verify` phase:
</plugin>
----
-The Apache Camel security advisories are those of the catalog of the plugin,
so use the latest release of the plugin,
-whatever the Camel version of the project, to know the latest advisories.
+The Apache Camel security advisories are those of the catalog of the plugin,
merged with those published in the
+camel-website repository on GitHub, checked online once a day and kept in
`~/.camel/advisories` (shared with the Camel
+CLI), so an older plugin knows the advisories published after its release.
When GitHub cannot be reached, the copy of
+the day before is used, else those of the catalog, with a warning.
`advisoriesUrl` reads them from a mirror instead (a
+JSON file in the format of the catalog), and `offline` checks those of the
catalog only.
=== The offline OSV database
@@ -330,7 +333,9 @@ which then shows the vulnerabilities in the Security tab of
the repository:
| severity | low | The lowest severity to list: critical, high, medium or low.
| failOn | none | Fails the build when a vulnerability at or above this
severity is found (also one below `severity`): critical, high, medium, low, or
none to only report them.
| failOnError | false | Fails the build when the dependencies could not be
checked with OSV.dev or the OSV database (not reachable, no database).
Otherwise only the Apache Camel security advisories are checked then, with a
warning.
-| offline | false | Checks the Apache Camel security advisories of the catalog
only, without OSV.dev.
+| offline | false | Checks the Apache Camel security advisories of the catalog
only, without OSV.dev and without checking the advisories online.
+| advisoriesUrl | | Where the Apache Camel security advisories are checked
online: the GitHub contents API of camel-website (default
`\https://api.github.com/repos/apache/camel-website/contents/content/security`),
a mirror of it, or the URL or file of a JSON array in the format of the
catalog.
+| advisoriesCache | ~/.camel/advisories | Where the advisories checked online
are kept.
| osvDatabase | false | Checks with the offline OSV database instead of the
OSV.dev API.
| osvDatabaseUrl | | Where the offline OSV database is downloaded from, or a
ZIP file on disk (default
`\https://osv-vulnerabilities.storage.googleapis.com/Maven/all.zip`). Implies
`osvDatabase`.
| osvDatabaseCache | ~/.camel/osv | Where a downloaded OSV database is kept.
diff --git
a/catalog/camel-report-maven-plugin/src/main/java/org/apache/camel/maven/AuditMojo.java
b/catalog/camel-report-maven-plugin/src/main/java/org/apache/camel/maven/AuditMojo.java
index 8725b5cc980d..83cd19aaebe6 100644
---
a/catalog/camel-report-maven-plugin/src/main/java/org/apache/camel/maven/AuditMojo.java
+++
b/catalog/camel-report-maven-plugin/src/main/java/org/apache/camel/maven/AuditMojo.java
@@ -38,11 +38,13 @@ import org.apache.camel.catalog.cve.CveFinding;
import org.apache.camel.catalog.cve.CveScan;
import org.apache.camel.catalog.cve.Dependency;
import org.apache.camel.catalog.cve.HttpProxy;
+import org.apache.camel.catalog.cve.OnlineAdvisories;
import org.apache.camel.catalog.cve.OsvClient;
import org.apache.camel.catalog.cve.OsvDatabase;
import org.apache.camel.catalog.cve.VulnerabilitySource;
import org.apache.camel.tooling.maven.MavenDownloaderImpl;
import org.apache.camel.tooling.maven.MavenProxy;
+import org.apache.camel.tooling.model.SecurityAdvisoryModel;
import org.apache.camel.util.json.Jsoner;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.execution.MavenSession;
@@ -110,7 +112,8 @@ public class AuditMojo extends AbstractMojo {
private boolean failOnError;
/**
- * Checks the Apache Camel security advisories of the catalog only,
without OSV.dev.
+ * Checks the Apache Camel security advisories of the catalog only,
without OSV.dev and without checking the
+ * advisories online.
*/
@Parameter(property = "camel.audit.offline", defaultValue = "false")
private boolean offline;
@@ -136,6 +139,21 @@ public class AuditMojo extends AbstractMojo {
@Parameter(property = "camel.audit.osvDatabaseCache", defaultValue =
"${user.home}/.camel/osv")
private File osvDatabaseCache;
+ /**
+ * Where the Apache Camel security advisories are checked online, once a
day, and merged with those of the catalog
+ * of the plugin: the GitHub contents API of camel-website (default:
+ *
https://api.github.com/repos/apache/camel-website/contents/content/security), a
mirror of it, or the URL or file
+ * of a JSON array in the format of the catalog. Not with offline.
+ */
+ @Parameter(property = "camel.audit.advisoriesUrl")
+ private String advisoriesUrl;
+
+ /**
+ * Where the advisories checked online are kept, shared with the Camel CLI.
+ */
+ @Parameter(property = "camel.audit.advisoriesCache", defaultValue =
"${user.home}/.camel/advisories")
+ private File advisoriesCache;
+
/**
* The groupIds that are not checked, and not sent to OSV.dev, such as
those of the internal libraries of a company,
* separated by commas; {@code com.acme} also leaves out {@code
com.acme.billing}. The modules of the build are
@@ -207,8 +225,16 @@ public class AuditMojo extends AbstractMojo {
source = new OsvClient(proxy(OsvClient.API_URL));
}
}
+ List<SecurityAdvisoryModel> camelAdvisories =
CveAudit.advisories(catalog);
+ OnlineAdvisories.Result online = null;
+ if (!offline) {
+ String url = advisoriesUrl != null && !advisoriesUrl.isBlank() ?
advisoriesUrl : OnlineAdvisories.DEFAULT_URL;
+ online = OnlineAdvisories.load(url, advisoriesCache.toPath(),
OnlineAdvisories.DEFAULT_MAX_AGE, proxy(url),
+ camelAdvisories);
+ camelAdvisories = online.advisories();
+ }
CveAudit.Result result = CveAudit.audit(collected.deps(), Map.of(),
declared, collected.via(), null, catalog,
- source);
+ camelAdvisories, source);
Map<String, String> suppressed = readSuppressions();
Map<CveFinding, String> hidden = new LinkedHashMap<>();
@@ -230,6 +256,9 @@ public class AuditMojo extends AbstractMojo {
if (database != null && database.warning() != null) {
getLog().warn(database.warning());
}
+ if (online != null && online.warning() != null) {
+ getLog().warn(online.warning());
+ }
String note = database != null && database.updated() != null
? " (offline OSV database, updated " +
database.updated().toString().substring(0, 10) + ")" : "";
String more = hidden.isEmpty() ? "" : ", " + hidden.size() + "
suppressed";
diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang-projects.adoc
b/docs/user-manual/modules/ROOT/pages/camel-jbang-projects.adoc
index 73f0cadde951..b04641079d05 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-jbang-projects.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-jbang-projects.adoc
@@ -284,8 +284,7 @@ Defaults to CycloneDX format (`sbom.json`) with
`camel-main` runtime.
== Checking dependencies for known vulnerabilities
Check the dependencies of your integration, with the ones they bring in, for
known vulnerabilities (CVEs). Every JAR
-is checked against https://osv.dev[OSV.dev], and the Camel JARs against the
Apache Camel security advisories that ship
-with the Camel catalog:
+is checked against https://osv.dev[OSV.dev], and the Camel JARs against the
Apache Camel security advisories:
[source,bash]
----
@@ -324,6 +323,27 @@ shows the same for a running integration, and explains a
vulnerability with AI.
pipeline, the
xref:camel-report-maven-plugin.adoc#_camel_reportaudit[camel-report:audit] goal
does the same checks
on the dependencies Maven resolved, fails the build on a severity, and writes
a SARIF report.
+=== The Apache Camel security advisories
+
+The Apache Camel security advisories that ship with the Camel catalog are
those published up to the release of the
+CLI. The command also checks them online, in the camel-website repository on
GitHub where they are published
+(https://github.com/apache/camel-website/tree/main/content/security[content/security]),
and merges both, so an older
+CLI knows the advisories published after its release. They are checked once a
day and kept in `~/.camel/advisories`;
+a check downloads only the advisories that are new or changed, and sends no
coordinates of the project. When GitHub
+cannot be reached, the copy of the day before is used, else those of the
catalog, with a warning. The `--json`
+document says how many came online (`camelAdvisories`).
+
+A machine without access to GitHub can read them from a mirror: a JSON file in
the format of the catalog
+(`camel-security-advisories.json`), such as one kept on the repository manager
of the company, or a file on disk:
+
+[source,bash]
+----
+camel dependency audit
--advisories-url=https://nexus.corp.com/repository/camel/camel-security-advisories.json
+----
+
+With `--offline`, only those of the catalog are checked. Set the
`GITHUB_TOKEN` environment variable when a shared CI
+runner hits the rate limit of the GitHub API.
+
=== The offline OSV database
By default, the command sends the coordinates (`groupId:artifactId:version`)
of every dependency to the OSV.dev API,
diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang-tui-observe.adoc
b/docs/user-manual/modules/ROOT/pages/camel-jbang-tui-observe.adoc
index a8c8a14b7d86..1ab94af1e54c 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-jbang-tui-observe.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-jbang-tui-observe.adoc
@@ -462,8 +462,9 @@ image::jbang/camel-tui-chaos-explore.png[The exploration of
the chaos example on
The CVE Audit tab (under More > Project) scans all Maven dependencies on your
integration's classpath
against the https://osv.dev[OSV.dev] vulnerability database, and the Camel
JARs against the Apache Camel
-security advisories that ship with the Camel catalog. It queries every JAR
using the OSV batch
-API and displays known vulnerabilities grouped by severity (Critical, High,
Medium, Low).
+security advisories: those that ship with the Camel catalog, merged with those
published on camel-website, checked
+online once a day as `camel dependency audit` does (when that fails, the title
says which are used). It queries every
+JAR using the OSV batch API and displays known vulnerabilities grouped by
severity (Critical, High, Medium, Low).
Each vulnerability shows the CVE ID, its CVSS score, the affected artifact,
the version that fixes it (FIX
column: the fix of the line the artifact's version is in, or the Camel release
to upgrade to for a Camel
diff --git a/docs/user-manual/modules/ROOT/pages/camel-report-maven-plugin.adoc
b/docs/user-manual/modules/ROOT/pages/camel-report-maven-plugin.adoc
index 56b9e00527bb..13b3e95da7e9 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-report-maven-plugin.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-report-maven-plugin.adoc
@@ -271,8 +271,11 @@ Or run it in every build, in the `verify` phase:
</plugin>
----
-The Apache Camel security advisories are those of the catalog of the plugin,
so use the latest release of the plugin,
-whatever the Camel version of the project, to know the latest advisories.
+The Apache Camel security advisories are those of the catalog of the plugin,
merged with those published in the
+camel-website repository on GitHub, checked online once a day and kept in
`~/.camel/advisories` (shared with the Camel
+CLI), so an older plugin knows the advisories published after its release.
When GitHub cannot be reached, the copy of
+the day before is used, else those of the catalog, with a warning.
`advisoriesUrl` reads them from a mirror instead (a
+JSON file in the format of the catalog), and `offline` checks those of the
catalog only.
=== The offline OSV database
@@ -330,7 +333,9 @@ which then shows the vulnerabilities in the Security tab of
the repository:
| severity | low | The lowest severity to list: critical, high, medium or low.
| failOn | none | Fails the build when a vulnerability at or above this
severity is found (also one below `severity`): critical, high, medium, low, or
none to only report them.
| failOnError | false | Fails the build when the dependencies could not be
checked with OSV.dev or the OSV database (not reachable, no database).
Otherwise only the Apache Camel security advisories are checked then, with a
warning.
-| offline | false | Checks the Apache Camel security advisories of the catalog
only, without OSV.dev.
+| offline | false | Checks the Apache Camel security advisories of the catalog
only, without OSV.dev and without checking the advisories online.
+| advisoriesUrl | | Where the Apache Camel security advisories are checked
online: the GitHub contents API of camel-website (default
`\https://api.github.com/repos/apache/camel-website/contents/content/security`),
a mirror of it, or the URL or file of a JSON array in the format of the
catalog.
+| advisoriesCache | ~/.camel/advisories | Where the advisories checked online
are kept.
| osvDatabase | false | Checks with the offline OSV database instead of the
OSV.dev API.
| osvDatabaseUrl | | Where the offline OSV database is downloaded from, or a
ZIP file on disk (default
`\https://osv-vulnerabilities.storage.googleapis.com/Maven/all.zip`). Implies
`osvDatabase`.
| osvDatabaseCache | ~/.camel/osv | Where a downloaded OSV database is kept.
diff --git
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-dependency-audit.adoc
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-dependency-audit.adoc
index c461e0a04c50..23b1132639a0 100644
---
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-dependency-audit.adoc
+++
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-dependency-audit.adoc
@@ -19,6 +19,7 @@ camel dependency audit [options]
[cols="2,5,1,2",options="header"]
|===
| Option | Description | Default | Type
+| `--advisories-url` | Where the Apache Camel security advisories are checked
online, once a day, and merged with those of the catalog: the GitHub contents
API of camel-website (default:
\https://api.github.com/repos/apache/camel-website/contents/content/security),
a mirror of it, or the URL or file of a JSON array in the format of the catalog
| | String
| `--build-property` | Maven build properties, ex. --build-property=prop1=foo
| | List
| `--by-artifact` | One row per vulnerable JAR, with the version that fixes
all its CVEs | | boolean
| `--camel-spring-boot-version` | Camel version to use with Spring Boot | |
String
@@ -57,7 +58,7 @@ camel dependency audit [options]
| `--maven-wrapper` | Include Maven Wrapper files in exported project | true |
boolean
| `--name` | The integration name. Use this when the name should not get
derived otherwise. | | String
| `--observe` | Enable observability services | false | boolean
-| `--offline` | Checks the Apache Camel security advisories of the catalog
only, without OSV.dev | | boolean
+| `--offline` | Checks the Apache Camel security advisories of the catalog
only, without OSV.dev and without checking the advisories online | | boolean
| `--open-api` | Adds an OpenAPI spec from the given file (json or yaml file)
| | String
| `--osv-database` | Checks with the offline OSV database instead of the
OSV.dev API: the export of all the Maven vulnerabilities of OSV.dev, downloaded
once a day and matched locally, so no coordinates of the project leave the
machine | | boolean
| `--osv-database-url` | Where the offline OSV database is downloaded from,
such as a mirror on the repository manager of the company, or a ZIP file on
disk (default:
\https://osv-vulnerabilities.storage.googleapis.com/Maven/all.zip). Implies
--osv-database | | String
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json
b/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json
index 25a9d79a94c5..b93e38cad9be 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json
+++
b/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json
@@ -6,7 +6,7 @@
{ "name": "completion", "fullName": "completion", "description": "Generate
completion script for bash\/zsh", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.Complete", "options": [ { "names":
"-h,--help", "description": "Display this help and exit", "javaType":
"boolean", "type": "boolean" } ] },
{ "name": "config", "fullName": "config", "description": "Get and set user
configuration values", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.config.ConfigCommand", "options": [ {
"names": "-h,--help", "description": "Display this help and exit", "javaType":
"boolean", "type": "boolean" } ], "subcommands": [ { "name": "get", "fullName":
"config get", "description": "Display user configuration value", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.config.ConfigG [...]
{ "name": "debug", "fullName": "debug", "description": "Debug local Camel
integration", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Debug",
"options": [ { "names": "--ago", "description": "Use ago instead of yyyy-MM-dd
HH:mm:ss in timestamp.", "javaType": "boolean", "type": "boolean" }, { "names":
"--background", "description": "Run in the background", "defaultValue":
"false", "javaType": "boolean", "type": "boolean" }, { "names":
"--background-wait", "description": "How [...]
- { "name": "dependency", "fullName": "dependency", "description": "Displays
all Camel dependencies required to run", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.DependencyCommand", "options": [ {
"names": "-h,--help", "description": "Display this help and exit", "javaType":
"boolean", "type": "boolean" } ], "subcommands": [ { "name": "audit",
"fullName": "dependency audit", "description": "Checks the dependencies for
known vulnerabilities (CVEs) with OSV.dev and the Apach [...]
+ { "name": "dependency", "fullName": "dependency", "description": "Displays
all Camel dependencies required to run", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.DependencyCommand", "options": [ {
"names": "-h,--help", "description": "Display this help and exit", "javaType":
"boolean", "type": "boolean" } ], "subcommands": [ { "name": "audit",
"fullName": "dependency audit", "description": "Checks the dependencies for
known vulnerabilities (CVEs) with OSV.dev and the Apach [...]
{ "name": "dev", "fullName": "dev", "description": "Run in dev mode with
live reload", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Dev",
"options": [ { "names": "--background", "description": "Run in the background",
"defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names":
"--background-wait", "description": "How long to wait for the integration in
the background to start, before returning, in millis or as a duration such as
2m (true waits 60 secon [...]
{ "name": "dirty", "fullName": "dirty", "description": "Check if there are
dirty files from previous Camel runs that did not terminate gracefully",
"sourceClass": "org.apache.camel.dsl.jbang.core.commands.process.Dirty",
"options": [ { "names": "--clean", "description": "Clean dirty files which are
no longer in use, and the logs of the previous runs of the integrations (camel
log --previous)", "defaultValue": "false", "javaType": "boolean", "type":
"boolean" }, { "names": "-h,--help" [...]
{ "name": "doc", "fullName": "doc", "description": "Shows documentation
for kamelet, component, EIP, and other Camel resources", "sourceClass":
"org.apache.camel.dsl.jbang.core.commands.catalog.CatalogDoc", "options": [ {
"names": "--camel-version", "description": "To use a different Camel version
than the default version", "javaType": "java.lang.String", "type": "string" },
{ "names": "--download", "description": "Whether to allow automatic downloading
JAR dependencies (over the int [...]
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/DependencyAudit.java
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/DependencyAudit.java
index 286af1f95b26..3055f512167a 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/DependencyAudit.java
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/DependencyAudit.java
@@ -42,6 +42,7 @@ import org.apache.camel.catalog.cve.CveScan;
import org.apache.camel.catalog.cve.CvssScore;
import org.apache.camel.catalog.cve.Dependency;
import org.apache.camel.catalog.cve.HttpProxy;
+import org.apache.camel.catalog.cve.OnlineAdvisories;
import org.apache.camel.catalog.cve.OsvClient;
import org.apache.camel.catalog.cve.OsvDatabase;
import org.apache.camel.catalog.cve.VulnerabilitySource;
@@ -56,6 +57,7 @@ import org.apache.camel.dsl.jbang.run.common.CamelHome;
import org.apache.camel.tooling.maven.MavenArtifact;
import org.apache.camel.tooling.maven.MavenDownloaderImpl;
import org.apache.camel.tooling.maven.MavenGav;
+import org.apache.camel.tooling.model.SecurityAdvisoryModel;
import org.apache.camel.util.json.JsonArray;
import org.apache.camel.util.json.JsonObject;
@@ -103,7 +105,7 @@ public class DependencyAudit extends DependencyList {
String failOn = "low";
@Option(name = "offline", hasValue = false,
- description = "Checks the Apache Camel security advisories of the
catalog only, without OSV.dev")
+ description = "Checks the Apache Camel security advisories of the
catalog only, without OSV.dev and without checking the advisories online")
boolean offline;
@Option(name = "fail-on-error", hasValue = false,
@@ -116,6 +118,13 @@ public class DependencyAudit extends DependencyList {
+ " downloaded once a day and matched locally, so no
coordinates of the project leave the machine")
boolean osvDatabase;
+ @Option(name = "advisories-url",
+ description = "Where the Apache Camel security advisories are
checked online, once a day, and merged with those of the catalog:"
+ + " the GitHub contents API of camel-website
(default: " + OnlineAdvisories.DEFAULT_URL
+ + "), a mirror of it,"
+ + " or the URL or file of a JSON array in the format
of the catalog")
+ String advisoriesUrl;
+
@Option(name = "osv-database-url",
description = "Where the offline OSV database is downloaded from,
such as a mirror on the repository manager of the company,"
+ " or a ZIP file on disk (default: " +
OsvDatabase.DEFAULT_URL + "). Implies --osv-database")
@@ -125,6 +134,8 @@ public class DependencyAudit extends DependencyList {
private final List<MavenGav> directDeps = new ArrayList<>();
// the offline OSV database, when it is used
private OsvDatabase database;
+ // the Apache Camel security advisories checked online; null with --offline
+ private OnlineAdvisories.Result advisories;
@Override
public Integer doCall() throws Exception {
@@ -167,6 +178,8 @@ public class DependencyAudit extends DependencyList {
List<Dependency> deps = new ArrayList<>();
Map<String, Path> jars = new HashMap<>();
VulnerabilitySource source = null;
+ CamelCatalog catalog = new DefaultCamelCatalog();
+ List<SecurityAdvisoryModel> camelAdvisories = null;
if (!gavs.isEmpty()) {
boolean snapshot = gavs.stream().anyMatch(g ->
g.contains("SNAPSHOT"));
try (MavenDownloaderImpl downloader = new MavenDownloaderImpl()) {
@@ -174,6 +187,7 @@ public class DependencyAudit extends DependencyList {
downloader.setMavenSettingsSecurityLocation(mavenSettingsSecurity);
downloader.build();
source = vulnerabilitySource(downloader);
+ camelAdvisories = camelAdvisories(downloader, catalog);
for (MavenArtifact ma : downloader.resolveArtifacts(gavs,
Set.of(), true, snapshot)) {
MavenGav g = ma.getGav();
if (g.getVersion() == null || skipArtifact(g.getGroupId(),
g.getArtifactId(), g.getVersion())) {
@@ -188,10 +202,10 @@ public class DependencyAudit extends DependencyList {
}
if (source == null) {
source = vulnerabilitySource(null);
+ camelAdvisories = camelAdvisories(null, catalog);
}
- CamelCatalog catalog = new DefaultCamelCatalog();
return report("project", deps, CveAudit.audit(deps, jars, declared,
Map.of(), routeComponents(catalog),
- catalog, source));
+ catalog, camelAdvisories, source));
}
/** The classpath of a running integration, and the components of its
endpoints. */
@@ -219,7 +233,28 @@ public class DependencyAudit extends DependencyList {
String name = process.name() != null && !process.name().contains(" ")
? process.name() + " (" + process.pid() + ")" :
String.valueOf(process.pid());
return report("integration " + name, deps, CveAudit.audit(deps, jars,
declaredDependencies(process.status()),
- Map.of(), endpointComponents(process.status()), catalog,
vulnerabilitySource(null)));
+ Map.of(), endpointComponents(process.status()), catalog,
camelAdvisories(null, catalog),
+ vulnerabilitySource(null)));
+ }
+
+ /**
+ * The Apache Camel security advisories: those of the catalog, merged with
those checked online (--advisories-url),
+ * except with --offline. The proxy comes from the Maven settings of the
downloader (null to read them), else
+ * HTTPS_PROXY.
+ */
+ List<SecurityAdvisoryModel> camelAdvisories(MavenDownloaderImpl
downloader, CamelCatalog catalog) {
+ List<SecurityAdvisoryModel> fromCatalog = CveAudit.advisories(catalog);
+ if (offline) {
+ return fromCatalog;
+ }
+ String url = advisoriesUrl != null && !advisoriesUrl.isBlank() ?
advisoriesUrl : OnlineAdvisories.DEFAULT_URL;
+ Map<String, String> env = System.getenv();
+ HttpProxy proxy = !url.startsWith("http://") &&
!url.startsWith("https://") ? null
+ : downloader != null ? OsvProxy.resolve(downloader, env, url)
+ : OsvProxy.resolve(mavenSettings, mavenSettingsSecurity, env,
url);
+ advisories = OnlineAdvisories.load(url,
CamelHome.getCamelDir().resolve("advisories"),
+ OnlineAdvisories.DEFAULT_MAX_AGE, proxy, fromCatalog);
+ return advisories.advisories();
}
/**
@@ -345,6 +380,9 @@ public class DependencyAudit extends DependencyList {
if (database != null && database.warning() != null) {
outPrinter().printWarn(database.warning());
}
+ if (advisories != null && advisories.warning() != null) {
+ outPrinter().printWarn(advisories.warning());
+ }
String below = notListed > 0 ? " (" + notListed + " more below
--severity=" + severity + ")" : "";
if (findings.isEmpty()) {
outPrinter().println((notListed > 0
@@ -384,6 +422,18 @@ public class DependencyAudit extends DependencyList {
if (offline) {
doc.put("offline", true);
}
+ if (advisories != null) {
+ JsonObject adv = new JsonObject();
+ adv.put("total", advisories.advisories().size());
+ adv.put("online", advisories.online());
+ if (advisories.updated() != null) {
+ adv.put("updated", advisories.updated().toString());
+ }
+ if (advisories.warning() != null) {
+ adv.put("warning", advisories.warning());
+ }
+ doc.put("camelAdvisories", adv);
+ }
if (database != null) {
JsonObject db = new JsonObject();
db.put("location", database.location());
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/DependencyAuditTest.java
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/DependencyAuditTest.java
index 55248c8a3483..3e9ca872745a 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/DependencyAuditTest.java
+++
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/DependencyAuditTest.java
@@ -27,6 +27,8 @@ import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
+import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.catalog.DefaultCamelCatalog;
import org.apache.camel.catalog.cve.CveAudit;
import org.apache.camel.catalog.cve.CveFinding;
import org.apache.camel.catalog.cve.CveScan;
@@ -34,6 +36,7 @@ import org.apache.camel.catalog.cve.Dependency;
import org.apache.camel.catalog.cve.OsvDatabase;
import org.apache.camel.catalog.cve.VulnerabilitySource;
import org.apache.camel.dsl.jbang.core.common.CliException;
+import org.apache.camel.tooling.model.SecurityAdvisoryModel;
import org.apache.camel.util.json.JsonObject;
import org.apache.camel.util.json.Jsoner;
import org.junit.jupiter.api.Test;
@@ -193,4 +196,29 @@ class DependencyAuditTest {
audit.offline = true;
assertThat(audit.vulnerabilitySource(null)).isNull();
}
+
+ @Test
+ void theCamelAdvisoriesOfAMirrorAreMergedWithThoseOfTheCatalog(@TempDir
Path dir) throws IOException {
+ // CAMEL-27348: a file in the format of the catalog, with an advisory
the catalog does not know
+ Path file = Files.writeString(dir.resolve("advisories.json"), """
+ [{"cve": "CVE-2099-12345", "severity": "HIGH", "affected":
"From 4.0.0 before 9.0.0",
+ "components": ["camel-kafka"]}]""");
+ CamelCatalog catalog = new DefaultCamelCatalog();
+ int known = CveAudit.advisories(catalog).size();
+ DependencyAudit audit = new DependencyAudit();
+ audit.advisoriesUrl = file.toString();
+
+ List<SecurityAdvisoryModel> advisories = audit.camelAdvisories(null,
catalog);
+
+ assertThat(advisories).hasSize(known + 1);
+
assertThat(advisories).extracting(SecurityAdvisoryModel::getCve).contains("CVE-2099-12345");
+ CveAudit.Result result = new CveAudit.Result(List.of(), List.of(),
null);
+ JsonObject adv = (JsonObject) audit.jsonReport("project", 1, result,
List.of(), List.of()).get("camelAdvisories");
+ assertThat(adv.getInteger("online")).isEqualTo(1);
+ assertThat(adv.getInteger("total")).isEqualTo(known + 1);
+
+ // --offline: the catalog only
+ audit.offline = true;
+ assertThat(audit.camelAdvisories(null, catalog)).hasSize(known);
+ }
}
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/test/resources/golden/cli-help.txt
b/dsl/camel-jbang/camel-jbang-core/src/test/resources/golden/cli-help.txt
index f4c16a1b88a1..413bd60b0430 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/test/resources/golden/cli-help.txt
+++ b/dsl/camel-jbang/camel-jbang-core/src/test/resources/golden/cli-help.txt
@@ -2412,6 +2412,7 @@ Usage: camel dependency audit [-hy]
[--integration=<integration>]
[--by-artifact] [--json] [--severity=<severity>]
[--fail-on=<fail-on>] [--offline]
[--fail-on-error] [--osv-database]
+ [--advisories-url=<advisories-url>]
[--osv-database-url=<osv-database-url>]
[--output=<output>] [--dep=<dep>]
[--runtime=<runtime>] [--name=<name>]
@@ -2467,7 +2468,8 @@ Options:
none
Default: low
--offline Checks the Apache Camel security advisories of the
- catalog only, without OSV.dev
+ catalog only, without OSV.dev and without checking
+ the advisories online
--fail-on-error Exits 1 when the dependencies could not be checked
with OSV.dev or the OSV database (not reachable, no
database), instead of checking the Apache Camel
@@ -2477,6 +2479,14 @@ Options:
vulnerabilities of OSV.dev, downloaded once a day
and matched locally, so no coordinates of the
project leave the machine
+ --advisories-url=<advisories-url>
+ Where the Apache Camel security advisories are
+ checked online, once a day, and merged with those
of
+ the catalog: the GitHub contents API of
+ camel-website (default:
+
https://api.github.com/repos/apache/camel-website/contents/content/security),
+ a mirror of it, or the URL or file of a JSON array
+ in the format of the catalog
--osv-database-url=<osv-database-url>
Where the offline OSV database is downloaded from,
such as a mirror on the repository manager of the
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CveAuditTab.java
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CveAuditTab.java
index 7f0b04d7b80c..61c046d45598 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CveAuditTab.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CveAuditTab.java
@@ -53,6 +53,7 @@ import org.apache.camel.catalog.cve.CveFinding;
import org.apache.camel.catalog.cve.CveScan;
import org.apache.camel.catalog.cve.CvssScore;
import org.apache.camel.catalog.cve.Dependency;
+import org.apache.camel.catalog.cve.OnlineAdvisories;
import org.apache.camel.catalog.cve.OsvClient;
import org.apache.camel.catalog.cve.OsvDatabase;
import org.apache.camel.catalog.cve.VulnerabilitySource;
@@ -603,13 +604,33 @@ class CveAuditTab extends AbstractTableTab {
.map(d -> new Dependency(d.groupId(), d.artifactId(),
d.version())).toList();
// the source and the proxy are looked up for each scan, so a change
in the settings applies without a restart
VulnerabilitySource source = TuiSettings.vulnerabilitySource();
- sourceNote = source instanceof OsvDatabase db ? databaseNote(db) :
null;
+ OnlineAdvisories.Result advisories =
TuiSettings.camelAdvisories(ProjectOverviewAssist.catalog());
+ sourceNote = sourceNote(source instanceof OsvDatabase db ?
databaseNote(db) : null, advisories);
CveAudit.Result result = CveAudit.audit(deps, jars,
declaredDependencies(info), fallbackVia,
endpointComponents(current != null ? current : info),
ProjectOverviewAssist.catalog(),
- source);
+ advisories.advisories(), source);
applyResult(deps, result.findings(), null, result.osvError());
}
+ // the note of the title: the offline OSV database, and the Camel
advisories when they could not be checked online
+ static String sourceNote(String databaseNote, OnlineAdvisories.Result
advisories) {
+ String camel = null;
+ if (advisories.warning() != null) {
+ if (advisories.online() == 0) {
+ camel = "Camel advisories of the catalog";
+ } else if (advisories.updated() != null) {
+ camel = "Camel advisories of " +
advisories.updated().toString().substring(0, 10);
+ } else {
+ // the date of the cached copy could not be read
+ camel = "Camel advisories of an earlier copy";
+ }
+ }
+ if (databaseNote == null) {
+ return camel;
+ }
+ return camel == null ? databaseNote : databaseNote + ", " + camel;
+ }
+
static String databaseNote(OsvDatabase db) {
if (db.updated() == null) {
return null;
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/TuiSettings.java
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/TuiSettings.java
index 486662201d22..30113394e5eb 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/TuiSettings.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/TuiSettings.java
@@ -20,7 +20,10 @@ import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
+import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.catalog.cve.CveAudit;
import org.apache.camel.catalog.cve.HttpProxy;
+import org.apache.camel.catalog.cve.OnlineAdvisories;
import org.apache.camel.catalog.cve.OsvClient;
import org.apache.camel.catalog.cve.OsvDatabase;
import org.apache.camel.catalog.cve.VulnerabilitySource;
@@ -434,6 +437,16 @@ final class TuiSettings {
return OsvDatabase.open(url, CamelHome.getCamelDir().resolve("osv"),
OsvDatabase.DEFAULT_MAX_AGE, proxy);
}
+ /**
+ * The Apache Camel security advisories of the CVE Audit screen: those of
the catalog, merged with those of
+ * camel-website, checked online once a day and cached in {@code
~/.camel/advisories}, as
+ * {@code camel dependency audit} does.
+ */
+ static OnlineAdvisories.Result camelAdvisories(CamelCatalog catalog) {
+ return OnlineAdvisories.load(OnlineAdvisories.DEFAULT_URL,
CamelHome.getCamelDir().resolve("advisories"),
+ OnlineAdvisories.DEFAULT_MAX_AGE,
httpProxy(OnlineAdvisories.DEFAULT_URL), CveAudit.advisories(catalog));
+ }
+
private static String trimToNull(String value) {
if (value == null) {
return null;
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/resources/tui/help/cve-audit.md
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/resources/tui/help/cve-audit.md
index d8f4c7b326b1..97e2c5813200 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/resources/tui/help/cve-audit.md
+++
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/resources/tui/help/cve-audit.md
@@ -9,7 +9,9 @@ Vulnerability Database (NVD/CVE), and other ecosystem-specific
databases. The Camel advisories (https://camel.apache.org/security/)
tell which Camel release fixes a CVE of a Camel component, and how to
mitigate it meanwhile; they are checked even when OSV.dev cannot be
-reached.
+reached. Those of the catalog are merged with those published on
+camel-website, checked online once a day (`~/.camel/advisories`); when
+that fails, the title says which are used.
## Table Columns
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/CveAuditTabViewsTest.java
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/CveAuditTabViewsTest.java
index e7b3275901f8..d05a91e15772 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/CveAuditTabViewsTest.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/CveAuditTabViewsTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.dsl.jbang.core.commands.tui;
+import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -27,6 +28,7 @@ import dev.tamboui.tui.event.KeyCode;
import dev.tamboui.tui.event.KeyEvent;
import org.apache.camel.catalog.cve.CveFinding;
import org.apache.camel.catalog.cve.CveScan;
+import org.apache.camel.catalog.cve.OnlineAdvisories;
import org.apache.camel.catalog.cve.OsvClient;
import org.apache.camel.util.json.JsonArray;
import org.apache.camel.util.json.JsonObject;
@@ -149,6 +151,19 @@ class CveAuditTabViewsTest {
assertThat(row.getBoolean("usedByRoutes")).isFalse();
}
+ @Test
+ void theTitleNoteOfTheCamelAdvisories() {
+ Instant day = Instant.parse("2026-11-20T08:00:00Z");
+ assertThat(CveAuditTab.sourceNote(null, new
OnlineAdvisories.Result(List.of(), 3, day, null))).isNull();
+ assertThat(CveAuditTab.sourceNote(null, new
OnlineAdvisories.Result(List.of(), 3, day, "offline")))
+ .isEqualTo("Camel advisories of 2026-11-20");
+ assertThat(CveAuditTab.sourceNote(null, new
OnlineAdvisories.Result(List.of(), 0, null, "offline")))
+ .isEqualTo("Camel advisories of the catalog");
+ // the date of the cached copy could not be read
+ assertThat(CveAuditTab.sourceNote("offline OSV database", new
OnlineAdvisories.Result(List.of(), 3, null, "offline")))
+ .isEqualTo("offline OSV database, Camel advisories of an
earlier copy");
+ }
+
private String footer() {
List<Span> spans = new ArrayList<>();
tab.renderFooter(spans);
diff --git a/tooling/camel-tooling-model/pom.xml
b/tooling/camel-tooling-model/pom.xml
index 4c88e6758468..1d67a01e2557 100644
--- a/tooling/camel-tooling-model/pom.xml
+++ b/tooling/camel-tooling-model/pom.xml
@@ -39,6 +39,13 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-util-json</artifactId>
</dependency>
+ <!-- SecurityAdvisoryParser reads the YAML front matter of the
advisories; optional, as only it needs it -->
+ <dependency>
+ <groupId>org.snakeyaml</groupId>
+ <artifactId>snakeyaml-engine</artifactId>
+ <version>${snakeyaml-engine-version}</version>
+ <optional>true</optional>
+ </dependency>
<!-- testing -->
<dependency>
@@ -46,5 +53,10 @@
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
diff --git
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSecurityAdvisoriesMojo.java
b/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/SecurityAdvisoryParser.java
similarity index 55%
copy from
tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSecurityAdvisoriesMojo.java
copy to
tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/SecurityAdvisoryParser.java
index f72e7b5fb3fb..28c4c3c777d2 100644
---
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSecurityAdvisoriesMojo.java
+++
b/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/SecurityAdvisoryParser.java
@@ -14,13 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.maven.packaging;
+package org.apache.camel.tooling.model;
-import java.io.File;
-import java.net.http.HttpClient;
-import java.nio.file.Path;
import java.util.ArrayList;
-import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -29,39 +25,26 @@ import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.inject.Inject;
-
-import org.apache.camel.tooling.model.JsonMapper;
-import org.apache.camel.tooling.model.SecurityAdvisoryModel;
-import org.apache.camel.util.json.JsonArray;
-import org.apache.camel.util.json.Jsoner;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.project.MavenProjectHelper;
-import org.codehaus.plexus.build.BuildContext;
import org.snakeyaml.engine.v2.api.Load;
import org.snakeyaml.engine.v2.api.LoadSettings;
/**
- * Syncs the published Apache Camel CVE security advisories (the sources behind
- * <a href="https://camel.apache.org/security/">camel.apache.org/security</a>,
maintained as Markdown files with YAML
- * front matter in the camel-website git repository) into a JSON file shipped
with camel-catalog, the same way the known
- * releases are synced by {@code update-camel-releases}.
+ * Parses a published Apache Camel security advisory: a Markdown file with
YAML front matter in the camel-website
+ * repository ({@code content/security/CVE-*.md}), the source of <a
href="https://camel.apache.org/security/">
+ * camel.apache.org/security</a>. Used by the {@code
update-security-advisories} goal that syncs the advisories of the
+ * catalog, and by the CVE audit that checks them online. Needs {@code
org.snakeyaml:snakeyaml-engine}, an optional
+ * dependency of this module.
*/
-@Mojo(name = "update-security-advisories", threadSafe = true, defaultPhase =
LifecyclePhase.GENERATE_RESOURCES)
-public class UpdateSecurityAdvisoriesMojo extends AbstractGeneratorMojo {
+public final class SecurityAdvisoryParser {
- private static final String GIT_SECURITY_URL
- =
"https://api.github.com/repos/apache/camel-website/contents/content/security";
- private static final String WEBSITE_BASE_URL = "https://camel.apache.org";
+ /** The website the relative URL of an advisory is on. */
+ public static final String WEBSITE_BASE_URL = "https://camel.apache.org";
+
+ /** The name of an advisory file, such as {@code CVE-2025-27636.md}. */
+ public static final Pattern ADVISORY_FILE =
Pattern.compile("CVE-\\d{4}-\\d{4,}\\.md");
- private static final Pattern ADVISORY_FILE =
Pattern.compile("CVE-\\d{4}-\\d{4,}\\.md");
// the first segment must start with a letter so that lowercased JIRA ids
("camel-12444") never match
private static final Pattern COMPONENT_TOKEN =
Pattern.compile("camel-[a-z][a-z0-9]+(?:-[a-z0-9]+)*");
- private static final Pattern CVE_ID =
Pattern.compile("CVE-(\\d{4})-(\\d+)");
/**
* English prose that follows "Camel-" in advisory texts (e.g.
"Camel-internal headers", "non-Camel-prefixed names")
@@ -73,68 +56,14 @@ public class UpdateSecurityAdvisoriesMojo extends
AbstractGeneratorMojo {
"camel-internal", "camel-prefixed", "camel-specific",
"camel-side", "camel-namespace",
"camel-case", "camel-cased", "camel-based", "camel-related",
"camel-style");
- /**
- * The output directory for the generated catalog advisories file
- */
- @Parameter(defaultValue =
"${project.basedir}/src/generated/resources/org/apache/camel/catalog/advisories")
- protected File outDir;
-
- @Inject
- public UpdateSecurityAdvisoriesMojo(MavenProjectHelper projectHelper,
BuildContext buildContext) {
- super(projectHelper, buildContext);
- }
-
- @Override
- public void execute() throws MojoExecutionException, MojoFailureException {
- if (outDir == null) {
- outDir = new File(project.getBasedir(), "src/generated/resources");
- }
-
- try {
- getLog().info("Updating Camel security advisories from
camel-website");
- List<String> links = fetchAdvisoryLinks();
- List<SecurityAdvisoryModel> advisories = processAdvisories(links);
- if (advisories.isEmpty()) {
- throw new MojoExecutionException("No published security
advisories found in " + GIT_SECURITY_URL);
- }
-
advisories.sort(Comparator.comparingLong(UpdateSecurityAdvisoriesMojo::cveOrdinal));
- getLog().info("Found " + advisories.size() + " published security
advisories");
-
- JsonArray arr = new JsonArray();
- for (SecurityAdvisoryModel advisory : advisories) {
- arr.add(JsonMapper.asJsonObject(advisory));
- }
- String json = Jsoner.serialize(arr);
- json = Jsoner.prettyPrint(json, 4);
-
- Path path = outDir.toPath();
- updateResource(path, "camel-security-advisories.json", json);
- addResourceDirectory(path);
- } catch (Exception e) {
- throw new MojoExecutionException(e);
- }
- }
-
- private List<SecurityAdvisoryModel> processAdvisories(List<String> urls)
throws Exception {
- List<SecurityAdvisoryModel> answer = new ArrayList<>();
-
- try (HttpClient hc = HttpClient.newHttpClient()) {
- for (String url : urls) {
- SecurityAdvisoryModel model =
parseAdvisory(CamelWebsiteContent.download(hc, url));
- if (model != null) {
- answer.add(model);
- }
- }
- }
-
- return answer;
+ private SecurityAdvisoryParser() {
}
/**
* Parse one advisory Markdown file (YAML front matter). Returns {@code
null} for drafts, non-advisory pages and
* files without parseable front matter, so only published advisories are
included.
*/
- static SecurityAdvisoryModel parseAdvisory(String content) {
+ public static SecurityAdvisoryModel parse(String content) {
Map<String, Object> frontMatter = frontMatter(content);
if (frontMatter == null) {
return null;
@@ -208,7 +137,7 @@ public class UpdateSecurityAdvisoriesMojo extends
AbstractGeneratorMojo {
* not name components at all). Lowercased JIRA ids and common English
prose such as "Camel-internal" are filtered
* out.
*/
- static List<String> extractComponents(String... texts) {
+ public static List<String> extractComponents(String... texts) {
TreeSet<String> found = new TreeSet<>();
for (String text : texts) {
if (text == null) {
@@ -224,20 +153,6 @@ public class UpdateSecurityAdvisoriesMojo extends
AbstractGeneratorMojo {
return new ArrayList<>(found);
}
- private List<String> fetchAdvisoryLinks() throws Exception {
- try (HttpClient hc = HttpClient.newHttpClient()) {
- return CamelWebsiteContent.downloadUrls(hc, GIT_SECURITY_URL, name
-> ADVISORY_FILE.matcher(name).matches());
- }
- }
-
- private static long cveOrdinal(SecurityAdvisoryModel advisory) {
- Matcher matcher = CVE_ID.matcher(advisory.getCve() == null ? "" :
advisory.getCve());
- if (matcher.find()) {
- return Long.parseLong(matcher.group(1)) * 1_000_000L +
Long.parseLong(matcher.group(2));
- }
- return 0;
- }
-
private static String str(Object value) {
return value == null ? null : String.valueOf(value);
}
diff --git
a/tooling/maven/camel-package-maven-plugin/src/test/java/org/apache/camel/maven/packaging/UpdateSecurityAdvisoriesMojoTest.java
b/tooling/camel-tooling-model/src/test/java/org/apache/camel/tooling/model/SecurityAdvisoryParserTest.java
similarity index 78%
rename from
tooling/maven/camel-package-maven-plugin/src/test/java/org/apache/camel/maven/packaging/UpdateSecurityAdvisoriesMojoTest.java
rename to
tooling/camel-tooling-model/src/test/java/org/apache/camel/tooling/model/SecurityAdvisoryParserTest.java
index 4cf0d166f3bc..02b90c192114 100644
---
a/tooling/maven/camel-package-maven-plugin/src/test/java/org/apache/camel/maven/packaging/UpdateSecurityAdvisoriesMojoTest.java
+++
b/tooling/camel-tooling-model/src/test/java/org/apache/camel/tooling/model/SecurityAdvisoryParserTest.java
@@ -14,27 +14,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.maven.packaging;
+package org.apache.camel.tooling.model;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
-import org.apache.camel.tooling.model.JsonMapper;
-import org.apache.camel.tooling.model.SecurityAdvisoryModel;
import org.apache.camel.util.json.JsonObject;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
- * Tests the advisory front-matter parsing of {@link
UpdateSecurityAdvisoriesMojo} against canned copies of two real
- * published advisories: CVE-2025-27636 (recent front matter style) and
CVE-2013-4330 (old style).
+ * Tests the advisory front-matter parsing of {@link SecurityAdvisoryParser}
against canned copies of two real published
+ * advisories: CVE-2025-27636 (recent front matter style) and CVE-2013-4330
(old style).
*/
-class UpdateSecurityAdvisoriesMojoTest {
+class SecurityAdvisoryParserTest {
private static String fixture(String name) throws IOException {
- try (InputStream in = UpdateSecurityAdvisoriesMojoTest.class
+ try (InputStream in = SecurityAdvisoryParserTest.class
.getResourceAsStream("/security-advisories/" + name)) {
assertThat(in).as("fixture /security-advisories/" +
name).isNotNull();
return new String(in.readAllBytes(), StandardCharsets.UTF_8);
@@ -43,7 +41,7 @@ class UpdateSecurityAdvisoriesMojoTest {
@Test
void parsesRecentAdvisoryStyle() throws Exception {
- SecurityAdvisoryModel model =
UpdateSecurityAdvisoriesMojo.parseAdvisory(fixture("CVE-2025-27636.md"));
+ SecurityAdvisoryModel model =
SecurityAdvisoryParser.parse(fixture("CVE-2025-27636.md"));
assertThat(model).isNotNull();
assertThat(model.getCve()).isEqualTo("CVE-2025-27636");
@@ -59,7 +57,7 @@ class UpdateSecurityAdvisoriesMojoTest {
@Test
void parsesOldAdvisoryStyle() throws Exception {
- SecurityAdvisoryModel model =
UpdateSecurityAdvisoriesMojo.parseAdvisory(fixture("CVE-2013-4330.md"));
+ SecurityAdvisoryModel model =
SecurityAdvisoryParser.parse(fixture("CVE-2013-4330.md"));
assertThat(model).isNotNull();
assertThat(model.getCve()).isEqualTo("CVE-2013-4330");
@@ -82,7 +80,7 @@ class UpdateSecurityAdvisoriesMojoTest {
---
body
""";
- assertThat(UpdateSecurityAdvisoriesMojo.parseAdvisory(draft)).isNull();
+ assertThat(SecurityAdvisoryParser.parse(draft)).isNull();
String wrongType = """
---
@@ -92,16 +90,16 @@ class UpdateSecurityAdvisoriesMojoTest {
---
body
""";
-
assertThat(UpdateSecurityAdvisoriesMojo.parseAdvisory(wrongType)).isNull();
+ assertThat(SecurityAdvisoryParser.parse(wrongType)).isNull();
- assertThat(UpdateSecurityAdvisoriesMojo.parseAdvisory("no front
matter")).isNull();
- assertThat(UpdateSecurityAdvisoriesMojo.parseAdvisory(null)).isNull();
+ assertThat(SecurityAdvisoryParser.parse("no front matter")).isNull();
+ assertThat(SecurityAdvisoryParser.parse(null)).isNull();
}
@Test
void componentExtractionSkipsJiraIdsAndProse() {
// lowercased JIRA ids and English prose following "Camel-" must not
become component names
- assertThat(UpdateSecurityAdvisoriesMojo.extractComponents(
+ assertThat(SecurityAdvisoryParser.extractComponents(
"See CAMEL-12444 and CAMEL-23200 for the fix.",
"Camel-internal headers with non-Camel-prefixed names are
Camel-specific.",
"The camel-side filter uses the Camel-namespace and camel-case
naming on camel-kafka and camel-aws2-sqs."))
@@ -110,7 +108,7 @@ class UpdateSecurityAdvisoriesMojoTest {
@Test
void modelRoundTripsThroughJsonMapper() throws Exception {
- SecurityAdvisoryModel model =
UpdateSecurityAdvisoriesMojo.parseAdvisory(fixture("CVE-2025-27636.md"));
+ SecurityAdvisoryModel model =
SecurityAdvisoryParser.parse(fixture("CVE-2025-27636.md"));
JsonObject json = JsonMapper.asJsonObject(model);
SecurityAdvisoryModel copy =
JsonMapper.generateSecurityAdvisoryModel(json);
diff --git
a/tooling/maven/camel-package-maven-plugin/src/test/resources/security-advisories/CVE-2013-4330.md
b/tooling/camel-tooling-model/src/test/resources/security-advisories/CVE-2013-4330.md
similarity index 100%
rename from
tooling/maven/camel-package-maven-plugin/src/test/resources/security-advisories/CVE-2013-4330.md
rename to
tooling/camel-tooling-model/src/test/resources/security-advisories/CVE-2013-4330.md
diff --git
a/tooling/maven/camel-package-maven-plugin/src/test/resources/security-advisories/CVE-2025-27636.md
b/tooling/camel-tooling-model/src/test/resources/security-advisories/CVE-2025-27636.md
similarity index 100%
rename from
tooling/maven/camel-package-maven-plugin/src/test/resources/security-advisories/CVE-2025-27636.md
rename to
tooling/camel-tooling-model/src/test/resources/security-advisories/CVE-2025-27636.md
diff --git
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSecurityAdvisoriesMojo.java
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSecurityAdvisoriesMojo.java
index f72e7b5fb3fb..cc9eda6b6d79 100644
---
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSecurityAdvisoriesMojo.java
+++
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSecurityAdvisoriesMojo.java
@@ -22,10 +22,6 @@ import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -33,6 +29,7 @@ import javax.inject.Inject;
import org.apache.camel.tooling.model.JsonMapper;
import org.apache.camel.tooling.model.SecurityAdvisoryModel;
+import org.apache.camel.tooling.model.SecurityAdvisoryParser;
import org.apache.camel.util.json.JsonArray;
import org.apache.camel.util.json.Jsoner;
import org.apache.maven.plugin.MojoExecutionException;
@@ -42,8 +39,6 @@ import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProjectHelper;
import org.codehaus.plexus.build.BuildContext;
-import org.snakeyaml.engine.v2.api.Load;
-import org.snakeyaml.engine.v2.api.LoadSettings;
/**
* Syncs the published Apache Camel CVE security advisories (the sources behind
@@ -56,23 +51,8 @@ public class UpdateSecurityAdvisoriesMojo extends
AbstractGeneratorMojo {
private static final String GIT_SECURITY_URL
=
"https://api.github.com/repos/apache/camel-website/contents/content/security";
- private static final String WEBSITE_BASE_URL = "https://camel.apache.org";
-
- private static final Pattern ADVISORY_FILE =
Pattern.compile("CVE-\\d{4}-\\d{4,}\\.md");
- // the first segment must start with a letter so that lowercased JIRA ids
("camel-12444") never match
- private static final Pattern COMPONENT_TOKEN =
Pattern.compile("camel-[a-z][a-z0-9]+(?:-[a-z0-9]+)*");
private static final Pattern CVE_ID =
Pattern.compile("CVE-(\\d{4})-(\\d+)");
- /**
- * English prose that follows "Camel-" in advisory texts (e.g.
"Camel-internal headers", "non-Camel-prefixed names")
- * and therefore must not be mistaken for component artifact ids.
Deliberately not validated against the current
- * catalog instead: old advisories legitimately name components that have
since been removed or renamed
- * (camel-xstream, camel-hessian, camel-castor, camel-cxfrs, ...), which
must remain filterable.
- */
- private static final Set<String> COMPONENT_TOKEN_DENYLIST = Set.of(
- "camel-internal", "camel-prefixed", "camel-specific",
"camel-side", "camel-namespace",
- "camel-case", "camel-cased", "camel-based", "camel-related",
"camel-style");
-
/**
* The output directory for the generated catalog advisories file
*/
@@ -120,7 +100,7 @@ public class UpdateSecurityAdvisoriesMojo extends
AbstractGeneratorMojo {
try (HttpClient hc = HttpClient.newHttpClient()) {
for (String url : urls) {
- SecurityAdvisoryModel model =
parseAdvisory(CamelWebsiteContent.download(hc, url));
+ SecurityAdvisoryModel model =
SecurityAdvisoryParser.parse(CamelWebsiteContent.download(hc, url));
if (model != null) {
answer.add(model);
}
@@ -130,103 +110,10 @@ public class UpdateSecurityAdvisoriesMojo extends
AbstractGeneratorMojo {
return answer;
}
- /**
- * Parse one advisory Markdown file (YAML front matter). Returns {@code
null} for drafts, non-advisory pages and
- * files without parseable front matter, so only published advisories are
included.
- */
- static SecurityAdvisoryModel parseAdvisory(String content) {
- Map<String, Object> frontMatter = frontMatter(content);
- if (frontMatter == null) {
- return null;
- }
- if (!"security-advisory".equals(str(frontMatter.get("type")))) {
- return null;
- }
- Object draft = frontMatter.get("draft");
- if (Boolean.TRUE.equals(draft) || "true".equalsIgnoreCase(str(draft)))
{
- return null;
- }
- String cve = str(frontMatter.get("cve"));
- if (cve == null || cve.isBlank()) {
- return null;
- }
-
- SecurityAdvisoryModel model = new SecurityAdvisoryModel();
- model.setCve(cve.trim());
- model.setDate(trimmed(frontMatter.get("date")));
- String severity = str(frontMatter.get("severity"));
- if (severity != null) {
- model.setSeverity(severity.trim().toUpperCase(Locale.ROOT));
- }
- model.setSummary(trimmed(frontMatter.get("summary")));
- model.setAffected(trimmed(frontMatter.get("affected")));
- model.setFixed(trimmed(frontMatter.get("fixed")));
- model.setMitigation(trimmed(frontMatter.get("mitigation")));
-
- String url = str(frontMatter.get("url"));
- if (url == null || url.isBlank()) {
- url = "/security/" + model.getCve() + ".html";
- }
- if (url.startsWith("/")) {
- url = WEBSITE_BASE_URL + url;
- }
- model.setUrl(url.trim());
-
- model.setComponents(extractComponents(str(frontMatter.get("title")),
model.getSummary(),
- str(frontMatter.get("description")), model.getMitigation()));
- return model;
- }
-
- @SuppressWarnings("unchecked")
- static Map<String, Object> frontMatter(String content) {
- if (content == null) {
- return null;
- }
- String trimmedContent = content.stripLeading();
- if (!trimmedContent.startsWith("---")) {
- return null;
- }
- int start = trimmedContent.indexOf('\n');
- if (start < 0) {
- return null;
- }
- int end = trimmedContent.indexOf("\n---", start);
- if (end < 0) {
- return null;
- }
- String yaml = trimmedContent.substring(start + 1, end);
- try {
- Object parsed = new
Load(LoadSettings.builder().build()).loadFromString(yaml);
- return parsed instanceof Map ? (Map<String, Object>) parsed : null;
- } catch (Exception e) {
- return null;
- }
- }
-
- /**
- * The Camel components named by the advisory text, as {@code camel-*}
tokens (best-effort: some older advisories do
- * not name components at all). Lowercased JIRA ids and common English
prose such as "Camel-internal" are filtered
- * out.
- */
- static List<String> extractComponents(String... texts) {
- TreeSet<String> found = new TreeSet<>();
- for (String text : texts) {
- if (text == null) {
- continue;
- }
- Matcher matcher =
COMPONENT_TOKEN.matcher(text.toLowerCase(Locale.ROOT));
- while (matcher.find()) {
- if (!COMPONENT_TOKEN_DENYLIST.contains(matcher.group())) {
- found.add(matcher.group());
- }
- }
- }
- return new ArrayList<>(found);
- }
-
private List<String> fetchAdvisoryLinks() throws Exception {
try (HttpClient hc = HttpClient.newHttpClient()) {
- return CamelWebsiteContent.downloadUrls(hc, GIT_SECURITY_URL, name
-> ADVISORY_FILE.matcher(name).matches());
+ return CamelWebsiteContent.downloadUrls(hc, GIT_SECURITY_URL,
+ name ->
SecurityAdvisoryParser.ADVISORY_FILE.matcher(name).matches());
}
}
@@ -237,13 +124,4 @@ public class UpdateSecurityAdvisoriesMojo extends
AbstractGeneratorMojo {
}
return 0;
}
-
- private static String str(Object value) {
- return value == null ? null : String.valueOf(value);
- }
-
- private static String trimmed(Object value) {
- String text = str(value);
- return text == null ? null : text.trim();
- }
}