Skip to content

Commit 390e11d

Browse files
SOLR-17641: Disable the Security Manager when Java 24+ is detected (#3153)
Co-authored-by: Jan Høydahl <[email protected]>
1 parent 72d9716 commit 390e11d

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

solr/CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ Improvements
242242
* SOLR-17884: SolrJ users not using deprecated SolrClients can safely exclude Apache HttpClient dependencies.
243243
(David Smiley)
244244

245+
* SOLR-17641: Solr is now able to start on Java 24 and later, but with Security Manager disabled (Houston Putman, Jan Høydahl)
246+
245247
Optimizations
246248
---------------------
247249
(No changes)

solr/bin/solr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ if [[ $? -ne 0 ]] ; then
176176
exit 1
177177
else
178178
JAVA_VER_NUM=$(echo "$JAVA_VER" | grep -v '_OPTIONS' | head -1 | awk -F '"' '/version/ {print $2}' | sed -e's/^1\.//' | sed -e's/[._-].*$//')
179-
if [[ "$JAVA_VER_NUM" -lt "$JAVA_VER_REQ" ]] ; then
179+
if (( JAVA_VER_NUM < JAVA_VER_REQ )) ; then
180180
echo >&2 "Your current version of Java is too old to run this version of Solr."
181181
echo >&2 "We found major version $JAVA_VER_NUM, using command '${JAVA} -version', with response:"
182182
echo >&2 "${JAVA_VER}"
@@ -1137,6 +1137,11 @@ else
11371137
REMOTE_JMX_OPTS=()
11381138
fi
11391139

1140+
# Do not use the java security manager when running Java 24+
1141+
if (( JAVA_VER_NUM >= 24 )) ; then
1142+
export SOLR_SECURITY_MANAGER_ENABLED="false"
1143+
fi
1144+
11401145
# Enable java security manager (allowing filesystem access and other things)
11411146
if [ "${SOLR_SECURITY_MANAGER_ENABLED:-true}" == "true" ]; then
11421147
SECURITY_MANAGER_OPTS=('-Djava.security.manager' \

solr/bin/solr.cmd

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ IF NOT DEFINED SOLR_SSL_RELOAD_ENABLED (
9090
set "SOLR_SSL_RELOAD_ENABLED=true"
9191
)
9292

93-
REM Enable java security manager by default (limiting filesystem access and other things)
93+
REM Enable java security manager by default for Java 23 and before (limiting filesystem access and other things)
94+
IF !JAVA_MAJOR_VERSION! GEQ 24 (
95+
set SOLR_SECURITY_MANAGER_ENABLED=false
96+
)
9497
IF NOT DEFINED SOLR_SECURITY_MANAGER_ENABLED (
9598
set SOLR_SECURITY_MANAGER_ENABLED=true
9699
)

solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-9.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ Due to changes in Lucene 9, that isn't possible any more.
7474
SolrJ users not using SolrClients that use Apache HttpClient can safely exclude those dependencies.
7575
SolrJ users not using SolrClients that use Jetty HttpClient can safely exclude those dependencies.
7676

77+
=== Java Security Manager
78+
79+
Java has removed support for the Security Manager starting with Java 24; therefore, Solr will disable this feature when run with Java 24 or later. Solr previously used the Security Manager to provide an additional layer of protection against unintended file system access, network access, and process execution. Users upgrading to Java 24 or later should review their security practices and consider alternative measures, such as running Solr in containers or implementing additional operating system-level controls.
80+
7781
== Solr 9.9
7882

7983
=== SolrJ

0 commit comments

Comments
 (0)