seems reasonable. Could do something simple like:

Objects.requireNonNullElse(roles, List.of())...

https://docs.oracle.com/javase/9/docs/api/java/util/Objects.html#requireNonNullElse-T-T-

Kevin Risden


On Mon, Nov 7, 2022 at 12:29 PM Alex Deparvu <[email protected]> wrote:

> Hi,
>
> Just to add to this, it looks like this was introduced with commit [0] for
> SOLR-15776.
> If no one objects I will go ahead and create a Jira with a small fix for
> this issue.
>
> best
> alex
>
>
> [0]
>
> https://github.com/apache/solr/commit/a1406847ba256965e636e05b11e53c0ac696e2a9#diff-83579b1681fbe3ea47f7340796963b034594921405afb41c62d9415f52f5adcfR356
>
>
>
>
> On Fri, Nov 4, 2022 at 12:05 PM Alex Deparvu <[email protected]> wrote:
>
> > Hi,
> >
> > I am running a fresh build from the main branch and I am noticing the
> > following NPE happening in the logs:
> >
> > ERROR (qtp1527086220-49) [] o.a.s.h.RequestHandlerBase
> > java.lang.NullPointerException => java.lang.NullPointerException
> > at
> >
> org.apache.solr.security.RuleBasedAuthorizationPluginBase.getPermissionNamesForRoles(RuleBasedAuthorizationPluginBase.java:123)
> > java.lang.NullPointerException: null
> > at
> >
> org.apache.solr.security.RuleBasedAuthorizationPluginBase.getPermissionNamesForRoles(RuleBasedAuthorizationPluginBase.java:123)
> > ~[?:?]
> > at
> >
> org.apache.solr.handler.admin.SystemInfoHandler.getSecurityInfo(SystemInfoHandler.java:342)
> > ~[?:?]
> > at
> >
> org.apache.solr.handler.admin.SystemInfoHandler.handleRequestBody(SystemInfoHandler.java:153)
> > ~[?:?]
> >
> >
> > Logs seen on the Solr node originating the request:
> > 2022-11-04 09:26:46.251 INFO  (qtp1658512704-126) [] o.a.s.s.HttpSolrCall
> > [admin] webapp=null path=/admin/info/system
> > params={wt=javabin&version=2&_=1667579206203} status=0 QTime=1
> > 2022-11-04 09:26:46.259 WARN  (qtp1658512704-81) []
> > o.a.s.h.a.AdminHandlersProxy Exception when fetching result from node
> > localhost:6564_solr => java.util.concurrent.ExecutionException:
> > org.apache.solr.client.solrj.impl.BaseHttpSolrClient$RemoteSolrException:
> > Error from server at http://localhost:6564/solr:
> > java.lang.NullPointerException
> > at
> >
> org.apache.solr.security.RuleBasedAuthorizationPluginBase.getPermissionNamesForRoles(RuleBasedAuthorizationPluginBase.java:126)
> > java.util.concurrent.ExecutionException:
> > org.apache.solr.client.solrj.impl.BaseHttpSolrClient$RemoteSolrException:
> > Error from server at http://localhost:6564/solr:
> > java.lang.NullPointerException
> >
> >
> > All I did was set up a SolrCloud with 2 nodes and enabled basic auth
> > following the Solr guide (
> >
> https://solr.apache.org/guide/solr/latest/deployment-guide/basic-authentication-plugin.html#enable-basic-authentication
> > ).
> >
> > I believe the reason is the 'roles' set is null on inter-node requests so
> > this method will throw a NPE
> >
> https://github.com/apache/solr/blob/26195c82493422cb9d6d4bdf9d4452046e7b3f67/solr/core/src/java/org/apache/solr/security/RuleBasedAuthorizationPluginBase.java#L122
> >
> > Looking for some confirmation, I am happy to put together a PR for this.
> > The fix is simple enough.
> >
> >
> > best
> > alex
> >
> >
> >
> >
> >
>

Reply via email to