Package org.apache.solr.security
Class AllowListUrlChecker
java.lang.Object
org.apache.solr.security.AllowListUrlChecker
Validates URLs using an allow-list or a
ClusterState in SolrCloud.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AllowListUrlCheckerSingleton checker which allows all URLs.static final StringSystem property to enable URL checking against an allow-list and ignoreALLOW_ALL.static final StringClue given in URL-forbidden exceptions messages.static final StringSolrXmlConfigproperty to configure the allowed URLs. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckAllowList(List<String> urls) voidcheckAllowList(List<String> urls, org.apache.solr.common.cloud.ClusterState clusterState) Checks that the given URLs are present in the configured allow-list or in the providedClusterState(in case of cloud mode).static AllowListUrlCheckercreate(NodeConfig config) Creates a URL checker based on theNodeConfigproperty to configure the allowed URLs.Only for testing.booleanWhether this checker has been created with a non-empty allow-list of URLs.booleanWhether the URL checking is enabled.toString()
-
Field Details
-
URL_ALLOW_LIST
SolrXmlConfigproperty to configure the allowed URLs.- See Also:
-
ENABLE_URL_ALLOW_LIST
System property to enable URL checking against an allow-list and ignoreALLOW_ALL.- See Also:
-
SET_SOLR_DISABLE_URL_ALLOW_LIST_CLUE
Clue given in URL-forbidden exceptions messages.- See Also:
-
ALLOW_ALL
Singleton checker which allows all URLs.isEnabled()returns false.
-
-
Constructor Details
-
AllowListUrlChecker
- Parameters:
urlAllowList- List of allowed URLs. URLs must be well-formed, missing protocol is tolerated. An empty list means there is no explicit allow-list of URLs, in this case no URL is allowed unless aClusterStateis provided incheckAllowList(List, ClusterState).- Throws:
MalformedURLException- If a URL is invalid.
-
-
Method Details
-
create
Creates a URL checker based on theNodeConfigproperty to configure the allowed URLs. -
checkAllowList
- Throws:
MalformedURLException- See Also:
-
checkAllowList
public void checkAllowList(List<String> urls, org.apache.solr.common.cloud.ClusterState clusterState) throws MalformedURLException Checks that the given URLs are present in the configured allow-list or in the providedClusterState(in case of cloud mode).- Parameters:
urls- The list of urls to check.clusterState- The up to dateClusterState, can be null in case of non-cloud mode.- Throws:
MalformedURLException- If a URL is invalid.org.apache.solr.common.SolrException- If a URL is not present in the allow-list or in the providedClusterState.
-
hasExplicitAllowList
public boolean hasExplicitAllowList()Whether this checker has been created with a non-empty allow-list of URLs. -
isEnabled
public boolean isEnabled()Whether the URL checking is enabled. OnlyALLOW_ALLreturns false. -
getHostAllowList
Only for testing. -
toString
-