Skip to content

SOLR-18168: Remove path exclusion filter#4243

Open
dsmiley wants to merge 22 commits intoapache:mainfrom
dsmiley:RemovePathExclusionFilter
Open

SOLR-18168: Remove path exclusion filter#4243
dsmiley wants to merge 22 commits intoapache:mainfrom
dsmiley:RemovePathExclusionFilter

Conversation

@dsmiley
Copy link
Copy Markdown
Contributor

@dsmiley dsmiley commented Mar 27, 2026

Now that SolrServlet exists, we are unblocked from removing PathExclusionFilter. Instead, its task can be accomplished with web.xml configuration. Furthermore, admin UI serving should be exclusively tested with BATS (integration) – JettySolrRunner can be simpler.

SOLR-18168

dsmiley and others added 19 commits February 8, 2026 22:50
Co-authored-by: dsmiley <377295+dsmiley@users.noreply.github.com>
…evert-exclude-patterns

# Conflicts:
#	solr/test-framework/src/java/org/apache/solr/embedded/JettySolrRunner.java
#	solr/webapp/web/WEB-INF/web.xml
Revert excludePatterns changes; merge main into branch
# Conflicts:
#	solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
#	solr/test-framework/src/java/org/apache/solr/embedded/JettySolrRunner.java
#	solr/webapp/web/WEB-INF/web.xml
Removed abortErrorMessage -- unused
# Conflicts:
#	solr/core/src/java/org/apache/solr/core/ConfigSetService.java
…lter

# Conflicts:
#	solr/core/src/java/org/apache/solr/servlet/LoadAdminUiServlet.java
#	solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java
#	solr/core/src/java/org/apache/solr/servlet/SolrServlet.java
#	solr/core/src/test/org/apache/solr/servlet/LoadAdminUiServletTest.java
#	solr/server/solr/configsets/_default/conf/solrconfig.xml
#	solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml
#	solr/test-framework/src/java/org/apache/solr/embedded/JettySolrRunner.java
#	solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
#	solr/webapp/web/WEB-INF/web.xml
Copy link
Copy Markdown
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.

several files disappear here :-)

I plan to merge this ~Wednesday next week if I hear no need to improve anything.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The filter came and went inside a release. So instead I'm communicating the observed sum of the two.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The Gradle up-to-date tracking wasn't working so I fixed it. CC @epugh as I suspect you run these tests more than any of us.

<filter-mapping>
<filter-name>SolrFilter</filter-name>
<url-pattern>/*</url-pattern>
<servlet-name>default</servlet-name>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

referencing by name instead of URL pattern.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

more testing here to make up for the removal elsewhere. I was sure to check a random CSS file too as it's served via different routing path.

Copy link
Copy Markdown
Contributor

@epugh epugh left a comment

Choose a reason for hiding this comment

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

Shared some comments on bats test style!

}

inputs.dir(distDir)
inputs.dir('test') // Track .bats test files and helper as inputs
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for this, there are times when I get weirdness, and maybe this fixes that!

assert_output "200"

# Check Content-Type header is text/html
local content_type=$(curl -s -I http://localhost:${SOLR_PORT}/solr/ | grep -i "Content-Type:" | tr -d '\r')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this be a run and an assert include? Just to be more bats like and less fancy bass?

# Check if the HTTP response code is 200 (OK)
# Check that response body contains HTML
local response_body=$(curl -s http://localhost:${SOLR_PORT}/solr/)
[[ "$response_body" == *"<html"* ]] || [[ "$response_body" == *"<!DOCTYPE"* ]]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Likewise with the assert partial command?

local csp_header=$(curl -s -I http://localhost:${SOLR_PORT}/solr/ | grep -i "Content-Security-Policy:" | tr -d '\r')

# Check that the CSP header contains each of our custom URLs
[[ "$csp_header" == *"http://example1.com/token"* ]]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These could use the standard bats? I like keeping to the bats conventions as much as possible to reduce the learning when you read these!

@dsmiley
Copy link
Copy Markdown
Contributor Author

dsmiley commented Mar 29, 2026

I have another PR to follow this one that simplifies JettySolrRunner a bit but seems a touch out of scope to include in a PR ostensibly limited to removing PathExclusionFilter. I'll post it once this one merges. It removes all of the fields for filters. And it creates the filters in a generic fashion in a loop. Gzip goes... moves to a BATS test. The handful of classes needing a filter (like debug or rate limiting) are given a method to look it up by type.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@epugh I added some info based on your standards for BATS tests.

CC @janhoy as well as there's some other stuff I've added from experience lately

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