Skip to content

SOLR-17789: Fix Internode Authorization not working for external roles #3397

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

Open
wants to merge 4 commits into
base: branch_9x
Choose a base branch
from

Conversation

bct-timo-crabbe
Copy link

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

Description

Solr nodes do not pass full authorization details to other nodes.
Steps to reproduce:

  1. Deploy cluster with more then one node
  2. Use a authentication plugin where roles are supplied externally (like JWTAuth).
  3. Add a private collection with lower number of replicas then the number of nodes in the cluster
  4. Send request to node that does not holds a replica of the collection to force forwarding.

This results in a return code 403.

Solution

Add the current user's Security Principal on the HttpClientContext in the sendRemoteQuery method (solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java) like the executeMethod method on the HttPSolrClient (solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java)

Tests

testInternodeAuthorization on the jwt-auth plugin (solr\modules\jwt-auth\src\test\org\apache\solr\security\jwt\JWTAuthPluginIntegrationTest.java).

This test will setup a test cluster with three nodes, create a private collection with only two replicas and will query every node for the documents in the collection.

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 developed this patch against the branch_9x branch.
  • I have run ./gradlew check.
  • Failed on benchmarking tests
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide

@bct-timo-crabbe bct-timo-crabbe changed the base branch from main to branch_9x June 20, 2025 08:57
@bct-timo-crabbe bct-timo-crabbe changed the title Jira/solr 17789 SOLR-17789: Fix Internode Authorization not working for external roles Jun 20, 2025
Copy link
Contributor

@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.

Great work!
I love the test, especially. It will help me replace the remote query implementation while ensuring that the security characteristics are working. Passing principal / auth stuff is very subtle.

@@ -290,6 +291,53 @@ public void testMetrics() throws Exception {
HttpClientUtil.close(cl);
}

/**
* Test if JWTPrincipal is passed correctly on internode communication. Setup a cluster with more
* nodes using jwtAuth for both authentication and authorization.Add a private collection with
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* nodes using jwtAuth for both authentication and authorization.Add a private collection with
* nodes using jwtAuth for both authentication and authorization. Add a private collection with

What is a "private" collection?

Copy link
Author

Choose a reason for hiding this comment

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

A private collection is a collection that is not publicly available i.e., a collection where access has been restricted to certain user role(s). See the authorization section in the security.json the new test is using: solr/modules/jwt-auth/src/test-files/solr/security/jwt_plugin_jwk_security_with_authorization.json

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a restricted collection would make more sense?

Copy link
Contributor

Choose a reason for hiding this comment

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

"A collection with restricted access" is much clearer. "private collection" sounds like some documented/defined concept.

@bct-timo-crabbe
Copy link
Author

Can we still merge this in the upcoming 9.9 release?

Copy link
Contributor

@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.

Maybe too late; it's up to @HoustonPutman
I'm good with merging this and am happy to do it if Houston asks.

Obviously needs a CHANGES.txt but can be added last second by a committer. How about this wording?:

When Solr forwards/proxies requests to another node that can service the request, it needs to pass authorization headers.

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.

3 participants