Current state: Accepted, being implemented
Discussion thread: https://lists.apache.org/thread/7qqknryoh4hxv2s7291j8g5shlcbock3
JIRA:
Released: Solr 10.x (TBD)
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast). Confluence supports inline comments that can also be used.
Java Security Manager (JSM) was permanently removed in Java 24 (JEP 486). Solr previously relied on JSM to sandbox plugin code at runtime — restricting unauthorized file access, outbound network connections, System.exit() calls, and child process spawning. Without a replacement, Solr running on Java 24+ provides no runtime enforcement of these protections, leaving the JVM and any loaded plugin code unconstrained.
The OpenSearch project faced the same problem and solved it for OpenSearch 3.0 using a Java agent based on ByteBuddy instrumentation. See their write-up and the agent-sm source (Apache 2.0). This SIP proposes to use and adapt this approach.
The following new operator-facing interfaces are introduced:
server/lib/ext/solr-agent-sm-*.jar, loaded automatically via -javaagent: by the startup scripts when present.server/etc/agent-security.policy (JDK-style .policy syntax; ships with Solr; not intended for operator editing).server/etc/agent-security-extra.policy (optional; absent is non-fatal; entries tagged source=OPERATOR in violation logs).SOLR_SECURITY_AGENT_MODE=warn|enforce (default: warn) and SOLR_SECURITY_AGENT_SKIP=true to disable./admin/metrics under security.agent.violations.file, .network, .exit, .exec.SolrPaths.assertPathAllowed() deprecated for new callers; existing JSM security.policy and solr-tests.policy files marked deprecated.A new Gradle subproject solr/agent-sm/ will be created, producing a standalone Java agent JAR adapted from the Apache 2.0-licensed OpenSearch libs/agent-sm. The agent uses ByteBuddy @Advice instrumentation and StackWalker (Java 9+) to intercept JDK APIs at the bytecode level — applying to all code in the JVM including plugins, without requiring any code changes. It is virtual-thread safe (no thread-identity assumptions).
Four protection categories:
\\host\share) unconditionally blocked. Symlinks resolved to real path before policy check.*:<solr.port>, *:<zk-port>), covering all cluster nodes regardless of join order.System.exit() and Runtime.halt() restricted to an approved call-site list (SolrCLI, SolrDispatchFilter by default).ProcessBuilder.start() and Runtime.exec() restricted to an approved call-site list (empty by default in production).The initial release will use warn-only mode — violations are logged but operations are not blocked. Operators opt into enforce mode via SOLR_SECURITY_AGENT_MODE=enforce. A future release will flip the default.
Policy files use standard JDK .policy syntax extended with Solr variable substitution (${solr.home}, ${solr.port}, ${solr.zk.port}, etc.). The operator extension file ships with commented-out examples for all known modules that require external network access (jwt-auth, extraction/Tika, opentelemetry, s3-repository, gcs-repository, cross-dc-manager).
For a detailed specification and implementation plan - generated by Github's SpecKit, see http://cominvent.com/pub/jsm-spec.html.
server/etc/security.policy and solr-tests.policy JSM files are deprecated and retained as migration reference only; they are not enforced by the JVM on Java 24+.SolrPaths.assertPathAllowed() is deprecated for new callers; existing call sites are retained as defense-in-depth.This SIP restores runtime sandboxing for Solr on Java 24+ after JSM removal. Key points:
PolicyLoader — variable substitution, merging, error handling.SolrAgentIntegrationTest) running in enforce mode — all four protection categories exercised.