Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOLR-16781: Remove solrconfig.xml <lib> directives #2875

Merged
merged 9 commits into from
Dec 4, 2024

Conversation

gerlowskija
Copy link
Contributor

@gerlowskija gerlowskija commented Nov 19, 2024

https://issues.apache.org/jira/browse/SOLR-16781

Description

Solr offers a number of ways for users to add JARs and resources to their classpath, including:

  • solr.xml entries
  • SOLR_MODULES env-var/support
  • core and install-level "lib/" directories
  • the package manager
  • direct classpath modification

In addition to being largely redundant with the methods above, solrconfig.xml's directive has been a pain point and source of security concerns in the past.

Solution

This commit removes references and support from 'main'. Most of the functional changes live in SolrConfig.java, where we now check for tags only to log out a warning about them being no longer supported. The remainder of the PR consists of updates to our ref-guide, to recommend other means of adding JARs to Solr's classpath. Most of these are for first-party modules, which can use the SOLR_MODULES system.

This PR is only intended for main: I'll open a separate more forgiving PR for branch_9x that disables <lib> by default but allows it to be re-enabled via sysprop/envvar.

Still TODO:

  • decide whether vestigial trusted/untrusted configset support should be removed entirely
  • ensure that Solr examples use the necessary SOLR_MODULES for the libraries they rely on.
  • CHANGES.txt and Upgrade Notes

Tests

Some modifications made to existing tests to ensure that tags no longer function (particularly TestConfigSetsAPI).

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide

Solr offers a number of ways for users to add JARs and resources to
their classpath, including:

* solr.xml <sharedLib> entries
* SOLR_MODULES env-var/support
* core and install-level "lib/" directories
* the package manager
* direct classpath modification

In addition to being largely redundant with the methods above,
solrconfig.xml's <lib> directive has been a pain point and source of
security concerns in the past.  This commit removes it from Solr 10.

Still needed:
  - CHANGES.txt
  - Upgrade Notes / "Major Changes" docs
  - decision around vestigial "trusted configset" support
@epugh
Copy link
Contributor

epugh commented Nov 20, 2024

@gerlowskija how do you want to handle #2861? Should it go in first, or after?

@epugh
Copy link
Contributor

epugh commented Nov 22, 2024

@gerlowskija FYI I merged and backported https://issues.apache.org/jira/browse/SOLR-17556 to clear the decks, but which may impact this a bit. I think you plan for beefing up bin/solr start -e techproducts is a "good thing".

@gerlowskija
Copy link
Contributor Author

how do you want to handle #2861? Should it go in first, or after?

Sorry - missed this comment the other day. I'm glad I didn't prevent you from merging 2861 - I'm 👍 to incorporate any fallout into this PR.

@github-actions github-actions bot removed the configs label Nov 22, 2024
@gerlowskija
Copy link
Contributor Author

Alright - I've fixed merge conflicts, and tested out the examples, so this should be good to merge shortly. Thanks for the reviews all!

I've created a corresponding change for branch_9x that will disable <lib> by default, but still leave the feature available for users that really want it. Would appreciate any feedback there as well!

@@ -37,8 +37,6 @@

<luceneMatchVersion>${tests.luceneMatchVersion:LATEST}</luceneMatchVersion>

<lib dir="${solr.install.dir:../../../..}/modules/ltr/lib/" regex=".*\.jar" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this file doesn't need to exist at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch - removed!

@gerlowskija
Copy link
Contributor Author

One thing we'll probably want/need to come up with a better story around is model-serving.

Several places in our docs described using <lib> as a way not of loading new JARs, but of accessing model files. Users can still raise the ZK filesize limit and access their models from there, so we're not breaking those usecases. But all the same, it'd be great if there was a way to do this that didn't require modifying the ZK limit. (Does solr.xml's <sharedLib> tag already get us this maybe?)

@HoustonPutman
Copy link
Contributor

One thing we'll probably want/need to come up with a better story around is model-serving.

Several places in our docs described using <lib> as a way not of loading new JARs, but of accessing model files. Users can still raise the ZK filesize limit and access their models from there, so we're not breaking those usecases. But all the same, it'd be great if there was a way to do this that didn't require modifying the ZK limit. (Does solr.xml's <sharedLib> tag already get us this maybe?)

Yeah, it should, but there is also the $SOLR_ROOT_DIR/lib option as well

@gerlowskija gerlowskija merged commit c1062d9 into apache:main Dec 4, 2024
1 of 4 checks passed
@gerlowskija gerlowskija deleted the SOLR-16781-removal branch December 4, 2024 15:10
@gerlowskija
Copy link
Contributor Author

Alright - merged! Thanks all for the reviews!

We'll still need to decide whether to remove the last remnants of the "trusted" configset code, which this PR mostly leaves in tact since several components (e.g. ScriptUpdateProcessorFactory, XSLTUpdateRequestHandler) still rely on this distinction even with the <lib> code removed.

My vote would be to tear it out. All the places it's still used require the toggling of a module at startup (SOLR_MODULES=scripting), and I'm not sure that "trusted"-ness adds any value on top of that. Particularly given how many gaps have been found over time in the "trusted-config" code. But I'll make that case in its own JIRA ticket and we can discuss there...

@dsmiley
Copy link
Contributor

dsmiley commented Dec 5, 2024

My vote would be to tear it out.

+1
I'm glad to hear you suggest this. I thought I might have been alone in this thinking. I don't think we should "support" this idea; it's too burdensome for us to uphold this concept to a good standard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants