Skip to content

Commit 3ce9d6d

Browse files
committed
Ship ONLY httpclient5 5.6.1
The shadow jar task merges two dependency sources: a `fileTree` copy of jars from the ES source build (`elasticsearchMinimalCore`) and Maven-resolved dependencies from `elasticsearch-java` (`elasticsearchClient`). Because `elasticsearchMinimalCore` is listed first, its `httpclient5-5.5.jar` from x-pack-core takes precedence over the patched `httpclient5-5.6.1.jar` resolved via Maven from `elasticsearch-java 9.4.0`. Exclude httpclient5, httpcore5, and httpcore5-h2 from the x-pack-core module copy so the Maven-resolved versions are the sole source. This ensures the plugin ships the patched `httpclient5` `5.6.1` regardless of what version the ES server source build bundles. Related: - elastic/elasticsearch-java#1227 - elastic/elasticsearch#148345
1 parent d9d8aa0 commit 3ce9d6d

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

build.gradle

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,14 @@ task importMinimalElasticsearch() {
460460
}
461461
from(shadeElasticsearchStableBridge.outputs.files.singleFile)
462462
from(shadeElasticsearchGrokImplementation)
463-
from(buildElasticsearchLocalDistro.module("x-pack-core"))
463+
from(buildElasticsearchLocalDistro.module("x-pack-core")) {
464+
// Exclude httpclient5/httpcore5 jars so the Maven-resolved versions
465+
// from elasticsearch-java (via elasticsearchClient config) are used instead.
466+
// This ensures we always get the patched version (CVE-2026-40542).
467+
exclude jarPackageNamed("httpclient5")
468+
exclude jarPackageNamed("httpcore5")
469+
exclude jarPackageNamed("httpcore5-h2")
470+
}
464471

465472
from(buildElasticsearchLocalDistro.module("ingest-common")) {
466473
include jarPackageNamed("ingest-common")
@@ -562,6 +569,10 @@ task verifyImportedJars() {
562569
'org.brotli',
563570
'org.conscrypt',
564571

572+
// httpclient5/httpcore5 classes are excluded from the x-pack-core module copy
573+
// and instead provided by the elasticsearchClient configuration (via elasticsearch-java)
574+
'org.apache.hc',
575+
565576
// ES internal packages not used in Logstash context
566577
'org.elasticsearch.cli', // CLI tools
567578
'org.elasticsearch.entitlement', // Entitlement system

0 commit comments

Comments
 (0)