From bdac8ef210c4558d2ab10e1db73f4c43a5791232 Mon Sep 17 00:00:00 2001 From: Andrey Kolkov Date: Fri, 20 Nov 2026 15:54:15 +0700 Subject: [PATCH] fix(opensearch): disable the Base64 intrinsics hit by CVE-2026-114938 CVE-2026-114938 is an out-of-bounds write in the AVX-512 VBMI Base64 decoder of OpenJDK 17.0.6 and later, reachable on x86-64 hosts with attacker-supplied Base64. OpenSearch decodes the Basic credentials of a request before it authenticates it, so a tenant's cluster is exposed to anyone who can reach its HTTP port. Two of the three versions this chart offers bundle an affected JDK: opensearchproject/opensearch:3.0.0 carries 21.0.7 and 2.11.1 carries 17.0.8. 1.3.20 carries 11.0.25, which is not affected. OpenSearch has not released a build on a patched JDK yet. Start the nodes with -XX:-UseBASE64Intrinsics, which removes the vulnerable code path and leaves the other AVX-512 optimizations in place. It is delivered as a jvm.options.d file mounted from a ConfigMap, because neither obvious route works: bin/opensearch-env unsets JAVA_TOOL_OPTIONS, and setting nodePools[].jvm makes the operator stop sizing the heap from the memory request. The operator mounts general.additionalVolumes into the node pools and the bootstrap pod alike. Rolling this out restarts every OpenSearch cluster once. Tested with helm unittest, and by starting 3.0.0, 2.11.1 and 1.3.20 with the file mounted: each server JVM runs with the flag, and the heap passed in OPENSEARCH_JAVA_OPTS still applies. Assisted-by: LLM Signed-off-by: Andrey Kolkov (cherry picked from commit 65f09437101511ab88b88b50df2d925afb8c0744) Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com> --- .../opensearch/templates/jvm-options.yaml | 11 +++++ .../apps/opensearch/templates/opensearch.yaml | 12 ++++++ .../opensearch/tests/jvm_options_test.yaml | 42 +++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 packages/apps/opensearch/templates/jvm-options.yaml create mode 100644 packages/apps/opensearch/tests/jvm_options_test.yaml diff --git a/packages/apps/opensearch/templates/jvm-options.yaml b/packages/apps/opensearch/templates/jvm-options.yaml new file mode 100644 index 000000000..7228c53b2 --- /dev/null +++ b/packages/apps/opensearch/templates/jvm-options.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-jvm-options +data: + # -XX:-UseBASE64Intrinsics turns off the AVX-512 Base64 decoder hit by + # CVE-2026-114938: OpenSearch decodes the Basic credentials of a request + # before it authenticates it, and the image may bundle an OpenJDK that + # predates the fix. + cozystack.options: | + -XX:-UseBASE64Intrinsics diff --git a/packages/apps/opensearch/templates/opensearch.yaml b/packages/apps/opensearch/templates/opensearch.yaml index 9aba247ec..2f7cdbfef 100644 --- a/packages/apps/opensearch/templates/opensearch.yaml +++ b/packages/apps/opensearch/templates/opensearch.yaml @@ -17,6 +17,18 @@ spec: version: {{ include "opensearch.versionMap" $ }} httpPort: 9200 {{- /* + JVM options go in as a jvm.options.d file because neither other route works: + bin/opensearch-env unsets JAVA_TOOL_OPTIONS, and setting nodePools[].jvm makes + the operator stop sizing the heap from the memory request. + */}} + additionalVolumes: + - name: jvm-options + path: /usr/share/opensearch/config/jvm.options.d/cozystack.options + subPath: cozystack.options + restartPods: true + configMap: + name: {{ .Release.Name }}-jvm-options + {{- /* The operator's own way to raise vm.max_map_count is a privileged init container in every OpenSearch pod, and the PodSecurity level tenant namespaces run at refuses that before any pod exists. The sysctl comes from diff --git a/packages/apps/opensearch/tests/jvm_options_test.yaml b/packages/apps/opensearch/tests/jvm_options_test.yaml new file mode 100644 index 000000000..8195ee1d8 --- /dev/null +++ b/packages/apps/opensearch/tests/jvm_options_test.yaml @@ -0,0 +1,42 @@ +suite: opensearch JVM options + +release: + name: test-os + namespace: tenant-test + +set: + _cluster: + cluster-domain: cozy.local + +tests: + - it: ships the Base64 intrinsics switch as a jvm.options.d file + template: templates/jvm-options.yaml + asserts: + - isKind: + of: ConfigMap + - equal: + path: metadata.name + value: test-os-jvm-options + - equal: + path: data["cozystack.options"] + value: | + -XX:-UseBASE64Intrinsics + + - it: mounts that file into every pod of the cluster + template: templates/opensearch.yaml + documentSelector: + path: kind + value: OpenSearchCluster + asserts: + - contains: + path: spec.general.additionalVolumes + content: + name: jvm-options + path: /usr/share/opensearch/config/jvm.options.d/cozystack.options + subPath: cozystack.options + restartPods: true + configMap: + name: test-os-jvm-options + # setting jvm would stop the operator sizing the heap from the memory request + - notExists: + path: spec.nodePools[0].jvm