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-14853 enableRemoteStreaming and enableStreamBody are now sys props #1615

Merged
merged 8 commits into from May 10, 2023

Conversation

dsmiley
Copy link
Contributor

@dsmiley dsmiley commented May 2, 2023

No longer configSet / per-core.

Existing configuration (e.g. in solrconfig.xml or via config edit API) is ignored with a deprecation warning.

Even though this is a backwards incompatible change, I think it's fine in a minor release because:

  • is probably mostly being used in a local developer setting, not in production, thus backwards incompatibility is much less of a concern
  • it's easy to adapt
  • the user gets a warning if they don't
  • existing configs or config-edit won't fail (but will no-op admittedly)
  • improves security (defense-in-depth)

ref guide / changes.txt edits needed

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

@dsmiley dsmiley requested a review from janhoy May 2, 2023 05:55
@chatman

This comment was marked as resolved.

@chatman
Copy link
Contributor

chatman commented May 2, 2023

Existing configuration (e.g. in solrconfig.xml or via config edit API) is ignored with a deprecation warning.

I think they should be removed as well.

@janhoy
Copy link
Contributor

janhoy commented May 2, 2023

Did a quick browse, looks good. I agree that this change is acceptable in a minor release, for the reasons given.

@chatman, I think it makes sense to keep the core-level settings and APIs as no-ops in 9.x, declare them as deprecated in 9x and remove in main branch only.

For all the test-solrconfig.xml files I think we can do a global search/replace <requestParsers.*?enableRemoteStreaming=".*?" with <requestParsers and the same with stream body, as these are no-op anyway now.

@janhoy
Copy link
Contributor

janhoy commented May 2, 2023

We should also give these two new sysProps their own line and env.var in solr.in.sh? And unfortunately we'll also need some code in bin/solr[.cmd] for parsing it. I can contribute commits for this if you wish.

@dsmiley
Copy link
Contributor Author

dsmiley commented May 2, 2023

Sure; will remove from the configs in Solr -- easy enough.

Why modify solr.in.sh at all? I'd rather not; to be honest, I'd rather that file not exist at all (by default).

If/once Solr has a solr.env=prod|dev|test then we'd enable this setting in dev mode, and then feel no need later to give it such first class treatment to deserve it's very own env (which I assume is what motivated you to suggest an entry in solr.in.sh?).

@chatman
Copy link
Contributor

chatman commented May 2, 2023

If/once Solr has a solr.env=prod|dev|test then we'd enable this setting in dev mode

@dsmiley , there's already "-Dsolr.environment=prod" in Solr.

https://github.com/apache/solr/blob/main/solr/bin/solr.in.sh#L239-L242

@janhoy
Copy link
Contributor

janhoy commented May 2, 2023

Why modify solr.in.sh at all? I'd rather not; to be honest, I'd rather that file not exist at all (by default).

All lines in solr.in.sh are commented, so it is not needed by default. But the reason I'd prefer all sysprops to have their own ENV equivalent is for ease of configuration in e.g. Docker / k8s as a simple env.var instead of having to do SOLR_OPTS concatenation.

@dsmiley , there's already "-Dsolr.environment=prod" in Solr.

Yes, I put it in there, and all it does now is change color in Admin UI between envs :) We could certainly re-use it to set defaults for other things. But do we want remote streaming to be enabled by default in dev/test?

@dsmiley
Copy link
Contributor Author

dsmiley commented May 2, 2023

I propose in this issue not looking at solr.environment -- leave that for https://issues.apache.org/jira/browse/SOLR-15875

@chatman
Copy link
Contributor

chatman commented May 2, 2023

But do we want remote streaming to be enabled by default in dev/test?

Not in my opinion. Rather, I think we should remove remote streaming from Solr. If something shouldn't be used in production, it shouldn't exist in Solr.

@dsmiley
Copy link
Contributor Author

dsmiley commented May 2, 2023

BTW I want to call attention to

public Name getPermissionName(AuthorizationContext request) {

which feels weird to me. I don't think I love varying the permission of a handler based on wether remote streaming is enabled or not. Nor do I know why CONFIG_READ_PERM in particular was chosen. I suppose this is here because it's super easy to have Solr fetch whatever URL for you on your behalf... but if you enabled remote streaming then, shrug, it all seems moot honestly.

@chatman
Copy link
Contributor

chatman commented May 2, 2023

Good catch, David. I think the remote streaming "functionality" should be scrapped. DumpRequestHandler should either be scrapped or, at least, shouldn't be allowed to work with remote streaming, and the https://solr.apache.org/guide/8_11/content-streams.html page should be re-written to remove all references to such features.

@janhoy
Copy link
Contributor

janhoy commented May 2, 2023

Nor do I know why CONFIG_READ_PERM in particular was chosen.

You and I discussed this in the original PR to secure all request handlers: https://github.com/apache/solr/pull/372/files/ae46e8d101026c3439fb23a07d1603c884048765#r737730716

…DY in scripts

Signed-off-by: Jan Høydahl <janhoy@users.noreply.github.com>
@janhoy
Copy link
Contributor

janhoy commented May 2, 2023

Why modify solr.in.sh at all? I'd rather not; to be honest, I'd rather that file not exist at all (by default).

I'll push a change that only adds parsing of SOLR_ENABLE_REMOTE_STREAMING and SOLR_ENABLE_STREAM_BODY to the scripts, but nothing in solr.in.xx. That way we don't advertise this feature, while still allowing Solr to pick it up from the environment, and we can document both sys.prop and env.var in refGuide.

… files

Signed-off-by: Jan Høydahl <janhoy@users.noreply.github.com>
@janhoy
Copy link
Contributor

janhoy commented May 2, 2023

I'm going to commit solrconfig.xml fixes (removing now noop params and xml comments about them)

janhoy added 2 commits May 2, 2023 20:42
Signed-off-by: Jan Høydahl <janhoy@users.noreply.github.com>
Signed-off-by: Jan Høydahl <janhoy@users.noreply.github.com>
@janhoy
Copy link
Contributor

janhoy commented May 3, 2023

Only RefGuide & Changes left to do here I believe?

@dsmiley
Copy link
Contributor Author

dsmiley commented May 3, 2023

Yes. Thanks for your help, BTW. I'll be busy today but I offer this:

Proposed CHANGES.txt

  • SOLR-14853: Security: Converted enableRemoteStreaming and enableStreamBody solrconfig options into system properties and env vars. Attempts to set them the old way will no-op and log a warning. (me, Jan, Ishan)

upgrade notes:
In order to improve security, use of stream.file and stream.url and stream.body is no longer enabled via configuration in solrconfig.xml, nor dynamic equivalents with the config API. Instead, set an env var: ___ or ___ or system property equivalents.

Copy link
Contributor Author

@dsmiley dsmiley left a comment

Choose a reason for hiding this comment

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

This should do it. I'll commit in a couple days if nobody says anything.

formdataUploadLimitInKB="2048"
addHttpRequestToContext="false" />
----

The below command is an example of how to enable RemoteStreaming and BodyStreaming through the xref:config-api.adoc#commands-for-common-properties[Config API]:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I prefer to not show any example on how to set any of these requestParsers details dynamically, thus I did not swap out the examples for the other still-valid configuration attributes. IMO none of these should be in solrconfig.xml in the first place -- they are obscure things that I don't think someone would want to set on any one config (collection); instead I think all of them should be global. Making stuff configurable has some maintenance cost and are arcane details to many people. This is just my opinion.

dsmiley and others added 2 commits May 9, 2023 10:37
Co-authored-by: Jan Høydahl <janhoy@users.noreply.github.com>
@dsmiley dsmiley merged commit ffedc5b into apache:main May 10, 2023
5 of 6 checks passed
@dsmiley dsmiley deleted the SOLR-14853-disableConfigStream branch May 10, 2023 17:26
dsmiley added a commit that referenced this pull request May 10, 2023
…#1615)

Env vars: SOLR_ENABLE_REMOTE_STREAMING and SOLR_ENABLE_STREAM_BODY
Sys props: solr.enableRemoteStreaming and solr.enableStreamBody

solrconfig.xml (including via config-edit API) are now no-op; log a warning.
Backwards incompatible but easy to comply.

Co-authored-by: Jan Høydahl <janhoy@users.noreply.github.com>

---------

Signed-off-by: Jan Høydahl <janhoy@users.noreply.github.com>
Co-authored-by: Jan Høydahl <janhoy@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants